Hi,
I have a series of check boxes in my form. I have been trying to get it so one of the check boxes automatically checks/unchecks if text is entered or fully removed from a text field.
I can get it to 'check' when text is entered, but nothing I have tried is 'unchecking' when the text is removed and the field is empty.
The most logical script I tried seems to be this...
In the Change event of the text field (both the checkbox (named 'other')and the text field are wrapped in the same subform):
if
((this.rawValue != "") || (this.raw.Value != "null")) {
other.rawValue = "1";
}
else {
other.rawValue = "0";
}
This checks when a text character is typed into the field, but doesn't uncheck when they are deleted. I tried reversing it so the 'if' was rawValue "0" (using == instead of !=) and the else was rawValue "1" - and both ways round in the 'exit' event - again 'check' but no 'uncheck'. I have tried every combination of if/if and if/else I can think of.
I know I must be missing something obvious, but could anyone explain why this doesn't work, and how I can script it so that it does work?
Thank you!
TW
Solved! Go to Solution.
Views
Replies
Total Likes
Try this on Change event of the textfield.
var txtLength = xfa.event.newText.length;
if(txtLength > 0 ) {
CheckBox1.rawValue = "1";
}
else {
CheckBox1.rawValue = "0";
}
Hope this helps.
-Raghu.
Views
Replies
Total Likes
Try this on Change event of the textfield.
var txtLength = xfa.event.newText.length;
if(txtLength > 0 ) {
CheckBox1.rawValue = "1";
}
else {
CheckBox1.rawValue = "0";
}
Hope this helps.
-Raghu.
Views
Replies
Total Likes
Hi Raghu,
Huge thank you - that worked perfectly.
I really appreciate such quick help!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies