Highlighted

Reacting to a check box

New Here ,
Nov 08, 2020

Copy link to clipboard

Copied

I have a checkbox and a text field. When the box is checked, I want one value in the text field. When the check box is removed, I want another.

 

This works fine but the value doesn't appear in the text field until I put the cursor on it. I know it's there because other fields that depend on the text field are calculating correctly. The only problem is that I need to click on the text box to make the value appear. 

 

Here is the script, which granted is overly complicated, but I've been playing with it for a while to see if I have missed something.

 

var v1 = "";
var v2 = "";
v1=this.getField("Member Discount").value;
switch(v1) {
case "Yes":
v2=19.75;
break;
case "Off":
v2=0.00;
break;
}
event.value=v2

Adobe Community Professional
Correct answer by ls_rbls | Adobe Community Professional

I don't think your script is correct... it doesn't work like that on my end.

 

This is how it works on my end, and I am using your script as a Mouse-up javascript action from the radio button field:

 

var v1 = "";
var v2 = "";
v1=event.target.value;
switch(v1) {
case "Yes":    
v2=19.75;
break;
case "Off":
v2=0.00;
break;
}
this.getField("Member Discount").value=v2
TOPICS
PDF forms

Views

24

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

Reacting to a check box

New Here ,
Nov 08, 2020

Copy link to clipboard

Copied

I have a checkbox and a text field. When the box is checked, I want one value in the text field. When the check box is removed, I want another.

 

This works fine but the value doesn't appear in the text field until I put the cursor on it. I know it's there because other fields that depend on the text field are calculating correctly. The only problem is that I need to click on the text box to make the value appear. 

 

Here is the script, which granted is overly complicated, but I've been playing with it for a while to see if I have missed something.

 

var v1 = "";
var v2 = "";
v1=this.getField("Member Discount").value;
switch(v1) {
case "Yes":
v2=19.75;
break;
case "Off":
v2=0.00;
break;
}
event.value=v2

Adobe Community Professional
Correct answer by ls_rbls | Adobe Community Professional

I don't think your script is correct... it doesn't work like that on my end.

 

This is how it works on my end, and I am using your script as a Mouse-up javascript action from the radio button field:

 

var v1 = "";
var v2 = "";
v1=event.target.value;
switch(v1) {
case "Yes":    
v2=19.75;
break;
case "Off":
v2=0.00;
break;
}
this.getField("Member Discount").value=v2
TOPICS
PDF forms

Views

25

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
Nov 08, 2020 0
Adobe Community Professional ,
Nov 08, 2020

Copy link to clipboard

Copied

I don't think your script is correct... it doesn't work like that on my end.

 

This is how it works on my end, and I am using your script as a Mouse-up javascript action from the radio button field:

 

var v1 = "";
var v2 = "";
v1=event.target.value;
switch(v1) {
case "Yes":    
v2=19.75;
break;
case "Off":
v2=0.00;
break;
}
this.getField("Member Discount").value=v2

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...
Nov 08, 2020 0
try67 LATEST
Most Valuable Participant ,
Nov 08, 2020

Copy link to clipboard

Copied

The code seems fine to me, but where did you place it, exactly?

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...
Nov 08, 2020 0