Hi, I've looked everywhere in this forum and can't find the exact answer I'm after.
I have a numeric field that starts with a fixed value of '44', and 6 checkboxes. For each checkbox selected I want '2' subtracted from '44' e.g. if 1 checkbox is selected the value becomes '42' and if two checkboxes are selected the value becomes '40' and so on.
Is this possible? I'm going crazy trying to make this work.
Thanks for any help.
Solved! Go to Solution.
Views
Replies
Total Likes
Try this: Add code to the change event of the checkboxes
For example:
if (this.rawValue == "1") {
this.resolveNode("numericField1").rawValue = this.resolveNode("numericField1").rawValue - 2;
}
if (this.rawValue == "0") {
this.resolveNode("numericField1").rawValue = this.resolveNode("numericField1").rawValue + 2;
}
//the this.rawValue of 1 is a checked checkbox, 0 is unchecked. Using this code, a checked checkbox would subtract 2 from numericField1, and unchecked checkbox would add 2.
I had problems with this for a while because i had it in the click event not the change event.
Views
Replies
Total Likes
Try this: Add code to the change event of the checkboxes
For example:
if (this.rawValue == "1") {
this.resolveNode("numericField1").rawValue = this.resolveNode("numericField1").rawValue - 2;
}
if (this.rawValue == "0") {
this.resolveNode("numericField1").rawValue = this.resolveNode("numericField1").rawValue + 2;
}
//the this.rawValue of 1 is a checked checkbox, 0 is unchecked. Using this code, a checked checkbox would subtract 2 from numericField1, and unchecked checkbox would add 2.
I had problems with this for a while because i had it in the click event not the change event.
Views
Replies
Total Likes
That is brilliant! Thanks for that - worked perfectly!
Views
Replies
Total Likes
Glad to help. This one stumped me at first.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies