Form Validation (I want to restrict special characters in 1 of my form filed)

Re: Form Validation (I want to restrict special characters in 1 of my form filed)

by Aruna Kathiriya -
Number of replies: 1
Thanks Vitaly,
I used "pattern" in HTML statement.
I changed
$mform->addElement('text', $field, get_string($field), 'maxlength="100" size="30" ');
to
$mform->addElement('text', $field, get_string($field), 'maxlength="100" size="30" pattern="[A-Za-z0-9]+"');

This solved my issue.
Thanks for your reply.
Average of ratings: Useful (1)
In reply to Aruna Kathiriya

Re: Form Validation (I want to restrict special characters in 1 of my form filed)

by Saema Miftah -
Thanks it worked for me too!