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

pull script doesn't work grrrr

Community Beginner ,
Oct 02, 2020 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 = "";}

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms

Views

698

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

Community Expert , Oct 02, 2020 Oct 02, 2020

Do compare values use ==, not only one =

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

 

Votes

Translate

Translate
Community Expert ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

Do compare values use ==, not only one =

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

 

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
Community Beginner ,
Oct 02, 2020 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 = "";}

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
LEGEND ,
Oct 02, 2020 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.

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
Community Expert ,
Oct 02, 2020 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?

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
Community Beginner ,
Oct 02, 2020 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

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
Community Expert ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

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

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
Community Expert ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

What does you mean with "choicebox"?

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
Community Beginner ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

drop down box

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
Community Expert ,
Oct 02, 2020 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?

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
Community Beginner ,
Oct 02, 2020 Oct 02, 2020

Copy link to clipboard

Copied

LATEST

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!

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