Copy link to clipboard
Copied
I have a drop-down box asking is a "Shipping Address is the same as above". If they select "No" then text fields to have them enter the Address/City/St/Zip should be made visible. If they answer "Yes", that the Shipping Address is the same, then the Addess/City/St/Zip fields should be made to be hidden. Below is the code that I have, which isn't working, as selecting "No" does not hide any fields. The default selection for the field just displays "Please select", so the user knows they need to select something in that text box. I have the below Javascript set to run from the Actions tab on Mouse Up, in the Yes/No drop down box asking if the Shipping Address is the same as above.
if(this.getField("274 Shipping Addr Same?").value=="Yes"){
this.getField("274 Shipping FI Name").display = display.hidden;
this.getField("274 FI Attention Contact Form").display = display.hidden;
this.getField("274 Shipping Addr1").display = display.hidden;
this.getField("274 Shipping Addr2").display = display.hidden;
this.getField("274 Shipping FI City").display = display.hidden;
this.getField("274 FI Shipping State").display = display.hidden;
this.getFielNo("274 Shipping Zip").display = display.hidden;
}else{
if(this.getField("274 Shipping Addr Same?").value=="No"){
this.getField("274 Shipping FI Name").display = display.visible;
this.getField("274 FI Attention Contact Form").display = display.visible;
this.getField("274 Shipping Addr1").display = display.visible;
this.getField("274 Shipping Addr2").display = display.visible;
this.getField("274 Shipping FI City").display = display.visible;
this.getField("274 FI Shipping State").display = display.visible;
this.getField("274 Shipping Zip").display = display.visible;
}else{
this.getField("274 Shipping FI Name").display = display.hidden;
this.getField("274 FI Attention Contact Form").display = display.hidden;
this.getField("274 Shipping Addr1").display = display.hidden;
this.getField("274 Shipping Addr2").display = display.hidden;
this.getField("274 Shipping FI City").display = display.hidden;
this.getField("274 FI Shipping State").display = display.hidden;
this.getField("274 Shipping Zip").display = display.hidden;
}
}
Copy link to clipboard
Copied
Remove that code and place this one under the custom Validation event of the drop-down, and make sure to tick the option to commit the selected value immediately, under the field's Options tab in the Properties dialog, too:
if (event.value == "No") {
this.getField("274 Shipping FI Name").display = display.visible;
this.getField("274 FI Attention Contact Form").display = display.visible;
this.getField("274 Shipping Addr1").display = display.visible;
this.getField("274 Shipping Addr2").display = display.visible;
this.getField("274 Shipping FI City").display = display.visible;
this.getField("274 FI Shipping State").display = display.visible;
this.getField("274 Shipping Zip").display = display.visible;
} else {
this.getField("274 Shipping FI Name").display = display.hidden;
this.getField("274 FI Attention Contact Form").display = display.hidden;
this.getField("274 Shipping Addr1").display = display.hidden;
this.getField("274 Shipping Addr2").display = display.hidden;
this.getField("274 Shipping FI City").display = display.hidden;
this.getField("274 FI Shipping State").display = display.hidden;
this.getField("274 Shipping Zip").display = display.hidden;
}
If it still doesn't work check the JS Console for errors.
Edited: Fixed a mistake in the code
Copy link to clipboard
Copied
Remove that code and place this one under the custom Validation event of the drop-down, and make sure to tick the option to commit the selected value immediately, under the field's Options tab in the Properties dialog, too:
if (event.value == "No") {
this.getField("274 Shipping FI Name").display = display.visible;
this.getField("274 FI Attention Contact Form").display = display.visible;
this.getField("274 Shipping Addr1").display = display.visible;
this.getField("274 Shipping Addr2").display = display.visible;
this.getField("274 Shipping FI City").display = display.visible;
this.getField("274 FI Shipping State").display = display.visible;
this.getField("274 Shipping Zip").display = display.visible;
} else {
this.getField("274 Shipping FI Name").display = display.hidden;
this.getField("274 FI Attention Contact Form").display = display.hidden;
this.getField("274 Shipping Addr1").display = display.hidden;
this.getField("274 Shipping Addr2").display = display.hidden;
this.getField("274 Shipping FI City").display = display.hidden;
this.getField("274 FI Shipping State").display = display.hidden;
this.getField("274 Shipping Zip").display = display.hidden;
}
If it still doesn't work check the JS Console for errors.
Edited: Fixed a mistake in the code
Copy link to clipboard
Copied
That worked. Thanks!!!!!

