Copy link to clipboard
Copied
I could use some help with something I can't find on the forums. I have a fillable form with a drop down field named 'EmployeeName' and a text field named 'WorkDate' which is formatted to enter a custom date. I would like to ensure the user selects their name from the drop down list BEFORE they fill out the date in the text field. Is this even possible? or have some sort of alert message that pops up if they try entering the date before selecting their name? Thanks!!
Sure, that's possible. You can use this code as the custom validation script of the WorkDate field:
if (this.getField("EmployeeName").valueAsString==this.getField("EmployeeName").defaultValue) {
app.alert("Error! You must first select your name.")
event.rc = false;
}
That's exactly what I needed! Thank you so much!!
Copy link to clipboard
Copied
Sure, that's possible. You can use this code as the custom validation script of the WorkDate field:
if (this.getField("EmployeeName").valueAsString==this.getField("EmployeeName").defaultValue) {
app.alert("Error! You must first select your name.")
event.rc = false;
}
Copy link to clipboard
Copied
That's exactly what I needed! Thank you so much!!
Copy link to clipboard
Copied
Hi Try, I'm hoping you can help me. I added the script you provided me in the Work Date text field but it's causing an issue with the Clear Form button. When I clear the form everything clears except the work date and the alert message pops up. I have to add the Employee Name again, delete the date and then I can clear it. Is there a way of resolving this? I don't need the fields to be required, I just need to remind the user to add their name first. Thank you!!
Copy link to clipboard
Copied
That's the problem with using a Validation script. You can add a command to your Reset button to make the field not-required.
Copy link to clipboard
Copied
I'm looking at the button properties, how do add a command to make the field not required? Sorry, I'm a little confused 😞
Copy link to clipboard
Copied
Well, on the reset button I removed the checkbox to reset the work date field so at least the alert doesn't pop up but the work date field doesn't reset. I'm searching for what you suggested but I can't find anything.
Copy link to clipboard
Copied
You need to do it with a script, like this:
this.getField("WorkDate").required = false;
Copy link to clipboard
Copied
Ugh, I'm doing something wrong 😞 I think what you mean is to put this.getField("WorkDate").required = false; in Actions Run A Script in button properties, but that's not working. I'm sorry, I feel bad 😞
Copy link to clipboard
Copied
Please be more specific. What does "it's not working" means, exactly?
Copy link to clipboard
Copied
I still get the alert pop up to enter employee name first when I hit the clear form button
Copy link to clipboard
Copied
This pops up when I hit Clear Form
Copy link to clipboard
Copied
This has nothing to do with the field being required or not...
Copy link to clipboard
Copied
Oh, sorry. I wasn't sure what you meant earlier. I don't know why the alert is popping up when I click on clear form 😞
Copy link to clipboard
Copied
Because that triggers the validation event...
Copy link to clipboard
Copied
I'm sorry I confused you. I shouldn't have said the fields don't need to be required.