how do I clear a field based on if the other field is blank?

I have two fields. One text field and one drop down. If the text field is blank then the drop down is reset. Can someone help me out with this problem? Thanks.

Joel Browne

2 Answers

Voted Best Answer

You can also add the following code as a Custom Keystroke Script to the text field, so it will work the way you want:

var prefix, postfix, v;
var value = event.value;

if(event.selStart >= 0)
    prefix = value.substring(0, event.selStart);
else prefix = "";
if(event.selEnd >= 0 && event.selEnd <= value.length)
    postfix = value.substring(event.selEnd, value.length);
else postfix = "";
v = prefix + event.change + postfix;

if(v == ""){
        this.resetForm(["Dropdown1"]); //change field name as needed;

enter image description here

By Almir R V Santos   

You can add the following script as a Custom Calculation Script to the dropdown list field:

var v = this.getField("Text1").value; //change field name as needed

if(v == "") {
    this.resetForm(["Dropdown1"]); //change field name as needed

enter image description here

Almir R V Santos   

Please specify a reason: