• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Not sure what could be wrong with my script...

Participant ,
May 10, 2016 May 10, 2016

Copy link to clipboard

Copied

Hello,

In a multipage form that on all the pages have the First Name, Last Name, first FName, and LName on the First page is unprotected and open for entry but following FName, LName on the other pages are protected ReadOnly with small twist on the filed names like HFName, HLName , AFName, ALName.....

What I want to do is that entry on the first page for FName, LName to be propagated on the other pages, so I run the following codes on the Validate tab or FName... LName is entered first then next field to be entered is FName.

=======================================

var aInput = event.value.split(" "); // make an array split at space

var sCharacter = '';

var sWord='';

// for each element of word array, capitalize the first letter

for(i = 0; i <aInput.length; i++)

   {

    aInput = aInput.substr(0, 1).toUpperCase() + aInput.substr(1).toLowerCase();

   } // end loop for input string

// rebuild input string with modified words with spaces

event.value = aInput.join(' ');

getField("HLName").value = getField("LName").value;

getField("HFName").value = getField("FName").value;

getField("LFName").value = getField("LName").value + ", " + getField("FName").value;

======================================

HLName is get populated but HFName is left empty on the 2nd page and LFName on the third page which was supposed to come out like "Llllllll, Ffffffff" comes out as "Llllllllll," no FName at the end...

I can't understand why the full code does not get executed... It is interesting that LName only runs the Validation part of the code not the copying to the other fields.

LName field

  

FName field

Let me know if you need more info.

Regards,

Jeff P...

TOPICS
Acrobat SDK and JavaScript , Windows

Views

525

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 11, 2016 May 11, 2016

If I understand things correctly, you should replace these two lines:

getField("HFName").value = getField("FName").value;

getField("LFName").value = getField("LName").value + ", " + getField("FName").value;

With the following:

getField("HFName").value = event.value;

getField("LFName").value = getField("LName").value + ", " + event.value;

Votes

Translate

Translate
LEGEND ,
May 11, 2016 May 11, 2016

Copy link to clipboard

Copied

If I understand things correctly, you should replace these two lines:

getField("HFName").value = getField("FName").value;

getField("LFName").value = getField("LName").value + ", " + getField("FName").value;

With the following:

getField("HFName").value = event.value;

getField("LFName").value = getField("LName").value + ", " + event.value;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 11, 2016 May 11, 2016

Copy link to clipboard

Copied

LATEST

Thanks a lot it worked... I spend hours on this to figure out why it does not work...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines