Copy link to clipboard
Copied
I guess the title of the discussion is a bit misleading because I have already figured out how to fill out a text field based on the value entered on another text field if a certain box is checked, however:
If the second checkbox is checked (var b2), I would like the user to be able to free text in that field. So essentially, I am asking how do I write Javascript for "Free Text" in an if statement.
I tried not having a second variable at all, however, if the user accidentally selects the first checkbox, the value remains in the text field even if the checkbox is unchecked afterwards.
var b1 = this.getField("RCB1").isBoxChecked(0);
var b2 = this.getField("RCB1").isBoxChecked(1);
if(b1)
event.value = this.getField("DLAST").value
if(b2)
event.value = (????????????????)
Copy link to clipboard
Copied
You can use only condition for b1 or use script in checkbox.
Copy link to clipboard
Copied
What do you mean?
I was able to condition for b1 and b2. For example, if I wanted b2 to autopopulate the fields based on other fields not stated in b1, I am successfully able to do so ... so I am unsure exactly how I can only condition for b1. Regardless, I am just trying to find how I can clear the fields via javascript and then allow the client to enter their own information. For now, I have conditioned the fields via Action tab to just reset the fields.
Copy link to clipboard
Copied
I purely think I am misunderstanding what you are saying.
Copy link to clipboard
Copied
If you wish for client to manually enter info, you have a couple of options.
1. If you are using calculation script, and you wish b1 to autopopulate and b2 to be for manual input, then don't use b2 option in your script, use only b1 like this:
var b1 = this.getField("RCB1").isBoxChecked(0);
if(b1)
event.value = this.getField("DLAST").value;
If b2 is selected, then the script won't trigger, and you can input info.
2. Another option is to use scripts in checkbox instead.