[Scribus] Duplicate field values in FORM using Javascript?

Maciej Hanski ma_han2000
Wed Jun 20 21:37:18 CEST 2007


Prasad Mhatre napisa?(a):
> Dear Maciej Hanski,

Hi Prasad,

please respond below the original text for better readability:)


> Thans a TON for the script.
> BTW I was succesful in adding document wide script, while the form element 
> works fine.
> I have in fact seperate fields for FirstNAme, MiddleName and LastName, which 
> is entered by the user, while one field that is to be populated with all 
> these 3 values. e.g FirstName MiddleName Last Name
> I tried doing
> event.value = trim(this.getField("FirstName").value, 
> (this.getField("MiddleName").value, (this.getField("LastName").value, );
> but it returns only the last value(e.g. LastName).
> I can do seperately but it doesn't look nice since the field size may vary 
> depending on the no. of characters in the name fields. It will look odd to 
> see something like this..
> 
> Prasad                                 MiddleName 
> Mhatre
> If trimming is added it will look like this
> Prasad MiddleName Mhatre
> 
> I tried using event.value = trim(this.getField("FirstName").value
> but it doesn't work.

Hmm, you think too complicated, try this (in one line):

event.value = this.getField("FirstName").value +"  "+
this.getField("MiddleName").value +"  "+ this.getField("LastName").value;


> 
> Please remember I am not at all Javascript man.

Not yet, but soon:) See this article (under "String operators"):

http://www.w3schools.com/js/js_operators.asp

cheers
Maciej





More information about the scribus mailing list