Highlighted

pull script doesn't work grrrr

Community Beginner ,
Oct 02, 2020

Copy link to clipboard

Copied

Hi all,
A issue I have is this.
I do have a choicebox for A, B, C, and D [Choice_01]

Theres a textfield [Output_01]wich is triggered by the choicebox

Last is a textfield [txtResult_1] wich should pull from [Output_01]
To pull I use next script, but it doesn't work and I can't figure out why not.
I hope you see what's wrong. Thanks all.
var f = this.getField("txtResult_1");
if (event.value="Juist") {
f.fillColor = color.green;
f.textColor = color.black;
f.value = "Dit is het juiste antwoord!";}

else if (event.value="Onjuist"){
f.fillColor = color.red
f.textColor = color.yellow;
f.value = "Dit antwoord is niet juist";
}
else{
f.fillColor = color.transparent
f.value = "";}

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Do compare values use ==, not only one =

E.g.: if (event.value == "Onjuist")

 

TOPICS
Create PDFs, Edit and convert PDFs, PDF forms

Views

129

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

pull script doesn't work grrrr

Community Beginner ,
Oct 02, 2020

Copy link to clipboard

Copied

Hi all,
A issue I have is this.
I do have a choicebox for A, B, C, and D [Choice_01]

Theres a textfield [Output_01]wich is triggered by the choicebox

Last is a textfield [txtResult_1] wich should pull from [Output_01]
To pull I use next script, but it doesn't work and I can't figure out why not.
I hope you see what's wrong. Thanks all.
var f = this.getField("txtResult_1");
if (event.value="Juist") {
f.fillColor = color.green;
f.textColor = color.black;
f.value = "Dit is het juiste antwoord!";}

else if (event.value="Onjuist"){
f.fillColor = color.red
f.textColor = color.yellow;
f.value = "Dit antwoord is niet juist";
}
else{
f.fillColor = color.transparent
f.value = "";}

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Do compare values use ==, not only one =

E.g.: if (event.value == "Onjuist")

 

TOPICS
Create PDFs, Edit and convert PDFs, PDF forms

Views

130

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
Oct 02, 2020 0
Adobe Community Professional ,
Oct 02, 2020

Copy link to clipboard

Copied

Do compare values use ==, not only one =

E.g.: if (event.value == "Onjuist")

 

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
Reply
Loading...
Oct 02, 2020 0
Community Beginner ,
Oct 02, 2020

Copy link to clipboard

Copied

Hallo Berndt,
Thanks for the input. Unfortunally it doesn't work.
If there's no value the textfield is green with the corresponding text.
On output "Onjuist" it remains green with corresponding text, not red with the corresponding text.

I would have it blanc wenn no output is there as you se at he end in the script.

I do use now and there's no pagescript or so.

var f = this.getField("txtResult_1");
if (event.value=="Juist") {
f.fillColor = color.green;
f.textColor = color.black;
f.value = "Dit is het juiste antwoord!";}

else if (event.value=="Onjuist"){
f.fillColor = color.red
f.textColor = color.yellow;
f.value = "Dit antwoord is niet juist";
}
else{
f.fillColor = color.transparent
f.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
Reply
Loading...
Oct 02, 2020 0
Most Valuable Participant ,
Oct 02, 2020

Copy link to clipboard

Copied

I'm assuming you are checking the console and there are no errors. Use app.alert to see which of the three { ... } sections is run. Often there are surprises. Also use app.alert to check the value of f.

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
Reply
Loading...
Oct 02, 2020 0
Most Valuable Participant ,
Oct 02, 2020

Copy link to clipboard

Copied

Where did you place the code? Are there any error messages in the JS Console when you use it?

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
Reply
Loading...
Oct 02, 2020 0
Community Beginner ,
Oct 02, 2020

Copy link to clipboard

Copied

Thanks for the answers and help.
No errors at all.
Choicebox is the box in which you choose between the choices I filled in. Is it called drop down list?
The code is placed in [txtResult_1] [confirm] [ adjusted validations script]
(I do hope the English is ok, my DC is in Dutch ;).afbeelding.png

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
Reply
Loading...
Oct 02, 2020 0
Most Valuable Participant ,
Oct 02, 2020

Copy link to clipboard

Copied

Check the JS Console (Ctrl+J) after changing the value of the field.

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
Reply
Loading...
Oct 02, 2020 0
Adobe Community Professional ,
Oct 02, 2020

Copy link to clipboard

Copied

What does you mean with "choicebox"?

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
Reply
Loading...
Oct 02, 2020 0
Community Beginner ,
Oct 02, 2020

Copy link to clipboard

Copied

drop down box

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
Reply
Loading...
Oct 02, 2020 0
Adobe Community Professional ,
Oct 02, 2020

Copy link to clipboard

Copied

You must use the script as validation of the dropdown list.

Or want you validate the value of the text field?

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
Reply
Loading...
Oct 02, 2020 0
Community Beginner ,
Oct 02, 2020

Copy link to clipboard

Copied

yesss!
Thanks all for the help.
Last i did as bernd advised and used the script to push [txtResult_1], that works fine and even
showd me that the field [Output_01] here has no use.
Splendid! The choice now directly pushes the color and text in [txtResult_1]
Thanks all for this!

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
Reply
Loading...
Oct 02, 2020 0