Form Validation on Registration form
In vanilla registration form, i have noticed that the validation of input fields is based in the fields of your table.
Now, i don't want the address, post code to be not required. What file do i need to edit? I'm using the register captcha form.
Best Answers
-
sahotataran ✭✭✭
you are going to have a little hard time to check out.
all views are located in
\applications\dashboard\views\entry
- select the view you have enabled - recaptcha or whichever u have.
- check the form action you have there - /entry/register
- look for the controller entry in /applications/dashboard/controllers
- look for class.entrycontroller.php
- look for function register in there and make changes
There was an error rendering this rich post.
0 -
x00 MVP
look at the RegisterCaptcha method
see
$this->UserModel->Validation->ApplyRule('FieldName', 'RuleName');
If you want to know how validation actually works look at
forum/library/core/class.validation.php
forum/library/core/functions.validation.php
You can see the existing rules that you can use and you can add rules like so
Validation->AddRule('RuleName','function:SomeFunction');
you can also do regular expressions e.g.
Validation->AddRule('RuleName','regex:`^[\d]{5}$`');
grep is your friend.
0 -
x00 MVP
Generally validation follows the schema, so if something is not required in the database, it is not required on the form. You can set the default value to null.
I can't give in depth programming coaching, that is not really reasonable to expect this. I gave you the answer. I suggest you delve a little deeper, or pay someone to do it for you.
Ideally you would avoid editing the core if you can, you can hook the user model if nessisary
grep is your friend.
0 -
x00 MVP
I read "i don't want the address, post code to be not required" to mean you wanted them to be required.
But in any event first check your schema in the database before editing any code. The only reason why I added the addrule, bit is becuase stuff like post codes are often validated, but not necessarily required.
I didn't really get from the OP what you wanted.
grep is your friend.
0
Answers
you are going to have a little hard time to check out.
all views are located in
There was an error rendering this rich post.
I have already looked at those files. But i don't see the script there that validates the input field.
Hi, i looked for function register in the class.entrycontroller.php but i couldn't found it.
Here is my form action:
$this->Form->Open(array('Action' => Url('/entry/register'), 'id' => 'Form_User_Register', 'enctype' => 'multipart/form-data'));
I'm using the registercaptcha form.
look at the RegisterCaptcha method
see
If you want to know how validation actually works look at
forum/library/core/class.validation.php
forum/library/core/functions.validation.php
You can see the existing rules that you can use and you can add rules like so
you can also do regular expressions e.g.
grep is your friend.
Hi x00, thanks for the response. This is the code in the recaptcha function that i saw:
What part should i edit here, so that the address, postcode and other fields of the form will not be required.
Currently it requires all field to be filled in and that is what i saw in my recaptcha function.
@littlelorly
Generally validation follows the schema, so if something is not required in the database, it is not required on the form. You can set the default value to null.
I can't give in depth programming coaching, that is not really reasonable to expect this. I gave you the answer. I suggest you delve a little deeper, or pay someone to do it for you.
Ideally you would avoid editing the core if you can, you can hook the user model if nessisary
grep is your friend.
I read "i don't want the address, post code to be not required" to mean you wanted them to be required.
But in any event first check your schema in the database before editing any code. The only reason why I added the addrule, bit is becuase stuff like post codes are often validated, but not necessarily required.
I didn't really get from the OP what you wanted.
grep is your friend.
Thank you X00, got your point. I just need to change the database settings. Set the fields to null. Thank you so much