Copy link to clipboard
Copied
Hello,
Apologies for the stupid quiestion! Im very new at this!
I have a peice of code that will let the user know that required text fields have not been filled in. the code is as follows:
if(this.getField("Text Field 1").value == "")
{
app.alert("must be filled in");
}
else if (this.getField("Text Field 2").value == "")
{
app.alert("must be filled in");
}
else
{
this.mailDoc({cTo: "Email Address", cSubject: this.getField("Text Field 1").valueAsString})
}
;
This works except it will not allow for an input of zero. This is fine on Text Field 1 as it should always be submitted as a 6 digit number, however on Text Field 2 it can be zero
I have tried setting as a numerical text field although this did not work
Use "===" instead of "==", and valueAsString instead of value.
Copy link to clipboard
Copied
Use "===" instead of "==", and valueAsString instead of value.
Copy link to clipboard
Copied
JavaScript is designed to make things easier for the programmer. In most languages things can be a string or a number but not both, but JavaScript magically converts. This is one of those cases where it is a complete pain.... !