Hello
I'm looking to have a section in my interactive form that is blank to begin with and if it is required the certain fields will be populated with text. My JS skills are basic but was able to put this together using another script I found - it doesn't work but hopefully sheds light on what I'm trying to achieve?
var selectedPrint_required = this.getField("Print_required").value; if (selectedPrint_required=="") event.value = "-"; else if (selectedPrint_required=="Yes") event.value = "iPrint";
The "Print_required" field is a checkbox and when unchecked I'd like the current field to display "-" and when checked I'd like it to display "iPrint". I have 5 other fields that need to replicate this action using the same checkbox as the trigger. I also have a dropdown that I'd like blank when the trigger checkbox is unchecked but with one of the options chosen when checked.
I hope this is possible. Thanks in advance for your help.
Hi.
Since the text field is automatically filled it don't need to be required, just set it as readonly to prevent edition.
Try this script placed in the checkbox (mouse up):
var oMyTextField = this.getField("TextField"); if (event.target.value != "Off") {oMyTextField.value = "iPrint";} else {oMyTextField.value = "-";}
(Replace TextField by its real name)
Don't forget to place the "-" as the default value in the text field, so it will be displayed after a reset.