Skip to main content
rakeshk21205956
Inspiring
March 14, 2018
Answered

Pdf form script to clear a text field and copying value with same button.

  • March 14, 2018
  • 1 reply
  • 4160 views

I want a single button in pdf form to perform the below task:

Copy the value of the first text field to second field and  then reset the first field without changing the value of second field to which the original value was copied.

I used the following script but it resets the both fields;

first field = Text1;

Second field = Text2;

script:

this.getField("Text2").value = this.getField("Text1").value;

resetForm(["Text1"]);

thanks

This topic has been closed for replies.
Correct answer rakeshk21205956

sorry for disturbing... finally i got it working. with below script :

document level script:

function one()

{this.getField("Text2").value = this.getField("Text1").value;

}

this script in button:

one();

resetForm(["Text1"]);

1 reply

rakeshk21205956
Inspiring
March 14, 2018

I also tried the below script :

function one()

{

this.getField("Text2").value = this.getField("Text1").value;

}

resetForm(["Text1"]);

but this also didnot worked.. it cleared both fields.

rakeshk21205956
rakeshk21205956AuthorCorrect answer
Inspiring
March 14, 2018

sorry for disturbing... finally i got it working. with below script :

document level script:

function one()

{this.getField("Text2").value = this.getField("Text1").value;

}

this script in button:

one();

resetForm(["Text1"]);

try67
Community Expert
Community Expert
March 14, 2018

yes, the original is also working but when i use it to my form it resets boths fields.. strange


If you want to share it (like I did, using something like Dropbox, Google Drive, Adobe Cloud, etc.), I'm happy to take a look at why it's not working.