I am using the UpdateProfile snippet with the lgnupdateprofile.chunk.tpl template.
I have noticed that UpdateProfile doesn’t seem to perform validation on the data entered into the form. IE: I can enter any values I want in any of the profile fields, including removing them, and they are accepted as is when the submit button is activated.
I need to have the ability to validate email addresses & phone numbers entered into the form.
I am trying to use FormIt to validate the form but without much luck, either embedded into the form resource or as a prehook to UpdateProfile.
IE:
[[FormIt?
&placeholderPrefix=``
&customValidators=`fiValidate.phone`
&validate=`email:required:email:,
phone:required:fiValidate.phone,
mobilephone:required:fiValidate.phone'
]]
[[UpdateProfile]]
or
[[!UpdateProfile? &prehooks=`myValidator`]]
snippet myValidator:
$modx->runSnippet(FormIt, array(
placeholderPrefix => ``
customValidators => `fiValidate.phone`
validate => `email:required:email:,
phone:required:fiValidate.phone,
mobilephone:required:fiValidate.phone`
));
How can I get UpdateProfile to validate form contents based on my specs?
Thanks