This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
UPPERCASE letters
Started 15 years ago by grisu59 | 4 posts |
-
I would like that in some fileds the user write only with UPPERCASE letters
For example in lastname and townHow can I setup this?
Thanks
Posted 15 years ago # -
Hi,
You need to do small customization then, edit your "includes/post-functions.php" file and go to line 324 and you'll see this code :
$validation_result = validate_element($target_input,$rules);
put these code exactly bellow that line
if ($form_id == '70' && $element_id == '4') { if (!ctype_upper($user_input[$element_name_2])) { $error_elements[$element_id] = "You must use upper case only !"; } }
Then change the form ID and element ID with yours. It should show error when a user input lower case character.
Those code will work on "name" type field and for the city, what field type do you use ?
MachForm Support
Posted 15 years ago # -
My form_id = '2'
My fields are COGNOME (lastname) element_2 and CITTA' (city) element_13it will work properly the same?
Posted 15 years ago # -
for your name field, the code should be like this :
if ($form_id == '2' && $element_id == '2') { if (!ctype_upper($user_input[$element_name_2])) { $error_elements[$element_id] = "You must use upper case only !"; } }
For the city, I assume you're using text field type. Then you can put these code , bellow line 168.
if ($form_id == '2' && $element_id == '13') { if (!ctype_upper($element_data])) { $error_elements[$element_id] = "You must use upper case only !"; } }
MachForm Support
Posted 15 years ago #
Reply
You must log in to post.