Creating a button to check the contents of a textfield

Participant ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

Hi everyone,

 

I am having problems to create a simple button that checks the content of a related textfield.

 

I´m using the following code in the Mouse Up section:

 

if (this.getField("Texto3") == "xxxxx") {

app.alert("Correct answer. Congratulations!", 3,0);

}

else
{

if (this.getField("Texto3") !== "xxxxx") {

app.alert("Sorry, try again!", 0,0);

this.getField("Texto3") = "";

}

 

Everytime I press the button field, I get the "Sorry, try again!" message, even though the word in the

text field is correct.

Can anyone say what I am doing wrong?

 

Would really apreciate to receive your kind reply.

 

Cheers,

 

Andre Salles

TOPICS
Create PDFs , JavaScript , PDF forms

Views

41

Likes

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

Adobe Community Professional , Apr 14, 2022 Apr 14, 2022

You forgot .value, use like this:

this.getField("Texto3").value

Likes

Translate

Translate
Adobe Community Professional ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

You forgot .value, use like this:

this.getField("Texto3").value

Likes

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 ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

LATEST

Thank you, Ms. Nurani!!! Cheers

Likes

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