Skip to main content
Known Participant
July 1, 2021
Answered

How do I create an alert that pops up when submit his clicked but not all fields are complete?

  • July 1, 2021
  • 1 reply
  • 3907 views

Hi! I know how to write an alert for a single field, but can't figure out how to make it work for several fields & check boxes in the submit button.  Here is my code for one field:

 

if (getField("Date").value=="") app.alert("Please complete the form before signing!", 0);

 

Thank you!

This topic has been closed for replies.
Correct answer Nesa Nurani

Hi! I tried to open your link but it says "site can't be reached". I tried a few other things with no luck. I also deleted the dropdown list and created a new one with the blank space being the default setting. 


Download link works fine for me.

When you set 'blank' as default, did you also change "" to " " in script regarding that field?

Maybe also try in dropdown field, under 'options' tab check 'Commit selected value immediately'.

1 reply

Nesa Nurani
Community Expert
Community Expert
July 1, 2021

Add other fields to comparison with these operators:

&& and

|| or

EXAMPLE:

if (getField("Date").value=="" || getField("Date2").value=="") Using 'or' operator will pop alert if any of those fields are empty.

While using 'and':

if (getField("Date").value=="" && getField("Date2").value=="") means alert will pop only if both fields are empty.

In your case I would go with 'or' operator.

Lori5ED9Author
Known Participant
July 1, 2021

When I type in the code below, it works for the "date" but not for the "vessel name". What am I missing?

Thank you!

 

if (getField("Date").value=="" || getField("Vessel Name").value=="") app.alert("Please complete the form before signing!", 3);

Nesa Nurani
Community Expert
Community Expert
July 1, 2021

Is it "vessel name" or "Vessel Name"?

Javascript is case sensitive.