Good Morning All;
I have now gone through 38 pages on the form to try to figure this out myself. I must have missed something or this day is getting way to long.
I am trying to fill a numeric field based on what is selected from a dropdown box.
For testing, I am only using 2 fields
DropDownList1 and Numeric Field1
I if (DropDownList1.rawValue == 1) {
NumericField1.rawValue = 25;
}
Else;
(DropDownList1.rawValue == 2) {
NumericField1.rawValue = 35;
}
Which did work. I am now getting the error " missing ; before statement
6:XFA: form1 [0]: #subform [0]: DropDownList [0]: exit "
Specify items value is checked off on the bindings tab for DropDownList1.
I stated this with only one selection which worked
if (DropDownList1.rawValue == 1) {
NumericField1.rawValue = 25;
}
Thanks All
Chomp
Solved! Go to Solution.
Views
Replies
Total Likes
If that's a copy/paste of your script you've got a semicolon after the "else" and "else" should be lower case.
And for nested ifs you need an "else if", so:
if (DropDownList1.rawValue == 1) {
NumericField1.rawValue = 25;
}
else if (DropDownList1.rawValue == 2) {
NumericField1.rawValue = 35;
}
//else if...
If you've got a lot of statements you might want to look at using a switch() statement which can be easier to read.
switch(DropDownList1.rawValue) {
case "1":
NumericField1.rawValue = 25;
break;
case "2":
NumericField1.rawValue = 35;
break;
//etc.
}
Views
Replies
Total Likes
If that's a copy/paste of your script you've got a semicolon after the "else" and "else" should be lower case.
And for nested ifs you need an "else if", so:
if (DropDownList1.rawValue == 1) {
NumericField1.rawValue = 25;
}
else if (DropDownList1.rawValue == 2) {
NumericField1.rawValue = 35;
}
//else if...
If you've got a lot of statements you might want to look at using a switch() statement which can be easier to read.
switch(DropDownList1.rawValue) {
case "1":
NumericField1.rawValue = 25;
break;
case "2":
NumericField1.rawValue = 35;
break;
//etc.
}
Views
Replies
Total Likes
Thank you Jono.
I had stated trying using the same "switch" statement but I used "if" instead.. Did not work that well.
Thanks Again
Chomp
Views
Replies
Total Likes
Views
Likes
Replies