I have a field in which the user can enter the first and last name to fill out my form. Sometimes users put their name and generate empty fields in my database. Remember that I cannot completely change this method, because this form is part of a larger project and is used by other sites of my company.
This is the part of the code where I need validation. I already have a check that ensures that the file is not empty, but I need more to make sure that there are two elements in the field, separated by a space.
<input name="fullname" class="fullname" type="text" value="#fullname#" maxlength="150"/>
<cfif fullname eq '' and check2 eq 'check2'>
<br /><span style="color:red">*you must enter your full name</span></cfif>
Check2 eq 'check2' checks if the form has already been submitted to ensure that the user submits their data twice.
I thought of using regular expressions for this, but unfortunately I am not very good at how to use regx in CF9 and the documentation through me through me.
I also thought of using Find or FindOneOF, any thoughts on this?
Also, I try to avoid using JQ, JS, etc., so please try to keep your suggestions based on the IF CF code.
Any help or various suggestions on how to solve this problem would be greatly appreciated.
source
share