Skip to main content
rakeshk21205956
Inspiring
Mar 14, 2018 8:02 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
rakeshk21205956
rakeshk21205956Correct answer
Inspiring
Mar 14, 2018 8:13 AM UTC

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"]);

13 replies

rakeshk21205956
Inspiring
Mar 14, 2018 8:08 AM UTC

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.

Translate
rakeshk21205956
rakeshk21205956AuthorCorrect answer
Inspiring
Mar 14, 2018 8:13 AM UTC

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"]);

Translate
try67
Community Expert
Community Expert
Mar 14, 2018 8:30 AM UTC

Your original script should have worked, too...

Translate