I want to pick from a list in the drop down. Depending on what is choosen then a box will be checked automatically. This
is what I have so far for script.
if (dropdown == "blah") then this.rawValue = 1
I am not sure if it should be JavaScript or FormCalc...I assume JavaScript since there is no calculation. I am also unsure whether to put the script on the dropdown box or the checkbox. Also which event do i use?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
The == is used to compare two values ...so you are using it correctly in the if statement. When yo want to assign a value to an object then a single = sign is used. So your code shoudl be CheckTwo.rawValue = 1.
You can use an OR condition to check multiple values in th eif statement. So if the checkbox is to be checked if they choose blah, blah1 or blah2 then you coudl do this:
if ((this.rawValue == "blah") || (this.rawValue == "blah1") || (this.rawValue == "blah2")) {
CheckTwo.rawValue = 1;
} else {
CheckTwo.rawValue = 0;
}
You have to make sure to uncheck the checkbox if none of those options are chosen. That way if they choose one of those options (the checkbox gets turned on) then they change their minds and choose a different value it must be turned off.
Make sense?
paul
Views
Replies
Total Likes
You need to place the code in the Exit/ Change event of the Dropdown.
Choose JavaScript.
Modified script.
if (dropdown.rawValue == "blah")
this.rawValue = 1;
Thanks
Srini
I have at least twenty items to choose from in the drop down box. So i need to script for ea
ch possible choice. How do i do that in java script?
if (this.rawValue == "blah)
CheckTwo.rawValue = 1;
elseif (this.rawValue == "blah2")
CheckTwo.rawValue = 1:
There are probably 10 that check one box and another then that check a different box.
Thanks
Views
Replies
Total Likes
You can either use multiple if elseif conditions (OR) you can use the switch case statements.
switch(n)
{
case 1:
execute code block 1
break;
case 2:
execute code block 2
break;
default:
code to be executed if n is different from case 1 and 2
}
One correction in my previous post, you can not access rawValue in Change event so you need to place the above code only in Exit event.
Thanks
Srini
Views
Replies
Total Likes
I am still having trouble with this. I want to choose a word from the drop down box (that has at least 25 options) and depending on the word I choose i want 1 or 2 checkboxes checked.
This is the script i have so far. Right now i have it set up on the drop down box as and exit.
if (this.rawValue == "blah")
CheckTwo.rawValue == 1;
if (this.rawValue == "blah2")
CheckEight.rawValue == 2;
There are 15 items that would make one check box checked and then 10 for the other checkbox. It would be nice if I could just list them all out.
Please HELP
Views
Replies
Total Likes
The == is used to compare two values ...so you are using it correctly in the if statement. When yo want to assign a value to an object then a single = sign is used. So your code shoudl be CheckTwo.rawValue = 1.
You can use an OR condition to check multiple values in th eif statement. So if the checkbox is to be checked if they choose blah, blah1 or blah2 then you coudl do this:
if ((this.rawValue == "blah") || (this.rawValue == "blah1") || (this.rawValue == "blah2")) {
CheckTwo.rawValue = 1;
} else {
CheckTwo.rawValue = 0;
}
You have to make sure to uncheck the checkbox if none of those options are chosen. That way if they choose one of those options (the checkbox gets turned on) then they change their minds and choose a different value it must be turned off.
Make sense?
paul
Views
Replies
Total Likes
Thank You...that has helped.
How do you make those two parallel lines. I can not figure that out. I just copy pasted from your email.
Views
Replies
Total Likes
The two 'parallel lines' Paul used are two 'pipe' characters (ASCII code 124). Usually it can be found in the keyboard, have a look at the key for backslash "\".
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies