Web Experience Factory Advance Field Validation
Using View and Form builder, the input form by default have a simple validation if the field is empty.
I need to check if an input text field already exist in the database.
Let’s say I have a text field call USERID. I need to check if there’s a same USERID in the table before I can save the document. Create a SQL Call builder to select base on USERID, eg
select * from TABLE where USERID = ?
Use Data Field Settings builder for the validation. For the USERID field, use the RegularExpression(RegExString) as Validation Op.
For the Argument, create an Action List builder that return the same USERID value if it is not found in the DB.
Example, I’ve create a Variable builder to store the error message to be display. Then I create the Action List builder. First check if the USERID is empty, if yes then return Empty error message. Then call the SQL and check if the result is 1 or more rows
The action list return false if the field empty or the USERID is found. If the USERID is NOT found, then it return the USERID itself which will make the regex validate same as the input.