This is not always desired (for more complicated data, it will probably be much easier to take a look, correct that one typo and continue with the rest of the form), so my preference is actually to mark the field so that the user knows which field needs to be corrected, and have the validation script not report a validation error back to the field: event.rc = true In that case, the previous value of the field is restored, and the user has to enter the data again. When you play around with the function, you’ll notice that the validation function is only called when the focus leaves the field, so you have to click outside of the field to actually make that error message pop up. In the latter case, we set rc to false, and also display an error message. The member ‘rc’ (or return code) is used to communicate back if the validation was successful or not. This script also includes a check for an empty string, so that the user can wipe out a wrong string and start from scratch.Īs I mentioned before, information is passed to the validation function in the event object, and in the code we see that the member ‘value’ is used to communicate the current value of the field. If (event.value != "" & event.value != "AAAA" & event.value != "BBBB")Īpp.alert("The entered value needs to be either 'AAAA' or 'BBBB'!") To make things easier to copy&paste, here is the script again: event.rc = true
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |