Remove required validation of default fields

Remove required validation of default fields

by Nishant Pandya -
Number of replies: 6
I am using moodle 2.9. 

I want to remove required validation of field Email from site Sign Up form. When new user visit our site & want to create a new a/c then Email is not required for him/her.

I have follow this LINK but I am only successfully removing required email field when admin can create a new user. 

How can I do this. Please help.

Thanks,

Nishant

Average of ratings: -
In reply to Nishant Pandya

Re: Remove required validation of default fields

by Torsten Händler -
moodle/login/signup_form.php  then 

change         $mform->addRule('email', get_string('missingemail'), 'required', null, 'server');

to         $mform->addRule('email', get_string('missingemail'), null, 'server');


and the same with email2


but why want you to do this? email is an unique field, every user must have an email. because they get an confirmation link for the new account. 


In reply to Torsten Händler

Re: Remove required validation of default fields

by Nishant Pandya -

Thanks Torsten.

This is my client requirement.

It's not working. Validation "*" sign is removed from the textbox label but if not filled email & submit the form then error comes i.e. Invalid email address & Missing email address

In reply to Nishant Pandya

Re: Remove required validation of default fields

by Torsten Händler -

Ok, it was an attempt :D

I think you can't change this because moodle needs an email. I think a user account without email is not possible. because if you activate registration then its an "Email-based self-registration" and an "Email-based self-registration" without email is not possbile

In reply to Torsten Händler

Re: Remove required validation of default fields

by Nishant Pandya -

Yes Torsten you are correct & I understand what you want to say.

But this is my client requirement & I have to fulfil my client's requirement 

In reply to Nishant Pandya

Re: Remove required validation of default fields

by Pinky Sharma -

Hi Nishant,

In that case you need to make changes in core code which is not recommended. In singnup_form.php, remove email validation code from validation function. 

Hope this will work for you.