[Scribus] Duplicate field values in FORM using Javascript?
Prasad Mhatre
prasad.mhatre
Wed Jun 20 08:53:42 CEST 2007
Dear Maciej Hanski,
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.
Please remember I am not at all Javascript man.
Thanks
Love and regards
Prasad
----- Original Message -----
From: "Maciej Hanski" <ma_han2000 at yahoo.de>
To: <scribus at nashi.altmuehlnet.de>
Sent: Wednesday, June 20, 2007 1:20 AM
Subject: Re: [Scribus] Duplicate field values in FORM using Javascript?
> Prasad Mhatre napisa?(a):
>> Dear Friends,
>>
>> Is it possible to duplicate the field values entered in a form?
>> Suppose I have two fields (viz. FirstName and another field Name) where
>> one
>> enters FirstName the second field Name is to be entered automatically,
>> i.e.
>> Second Name may not be entered, in this Name field the content of
>> FirstName
>> should be replicated.
>>
>> It sounds strange, why two fields should contain the same information,
>> but
>> I
>> need this on a form where there is an acknowledgment slip which contains
>> the
>> Name, and I expect no one should enter the same information again.
>>
>
> Dear Prasad,
> I strongly encourage you to have a read of some of the docs mentioned in
> my earlier post, e.g. these two sources:
>
> http://wiki.scribus.net/index.php/How_to_enhance_your_PDF_forms_with_JavaScript
> http://www.acrobatusers.com/tech_corners/javascript_corner/tips/index.php?sort=true&search_keyword=All
>
>
> As for copying field values:
>
> 1. Create two fields "text1" and "text1_copy"
>
> 2. Go to the PDF Properties of the "text1_copy" field, and click on the
> "Calculate" tab.
>
> 3. Select "Custom script" and insert this line there:
>
> event.value = this.getField("text1").value;
>
> 4. Since this copying action will be performed on leaving the "text1"
> field first, you could consider creating a dummy button called "Copy
> field values" (go to the Story Editor to enter this button description,
> btw) or something like this, just to force users to click on it to
> ensure, the last field will be copied too.
>
> 5. You might as well put all the copying actions into one document wide
> script and call this script from a "Copy field values" button (remember
> my explanations about document wide scripts in our "onBlur"
> conversation?). In this case, you would have to write
> this.getField("text1_copy").value = this.getField("text1").value instead
> of event.value for each field to be copied.
>
> hth
> Happy experimenting
> Maciej
> _______________________________________________
> Scribus mailing list
> Scribus at nashi.altmuehlnet.de
> http://nashi.altmuehlnet.de/mailman/listinfo/scribus
>
More information about the scribus
mailing list