DARKF3D3 Posted September 19, 2012 Share Posted September 19, 2012 I have added new fields into the registration form on my site, but now i don't undestand how can i add new control for the new field. For example i have added one new required field so i need to add an error like the other required field (name, surname, email...) I also need an error message for the field "confirm password", when it's different from the password. Someone could help me? PS: I'm using prestashop 1.4.9 Link to comment Share on other sites More sharing options...
yewster Posted September 19, 2012 Share Posted September 19, 2012 (edited) I have added new fields into the registration form on my site, but now i don't undestand how can i add new control for the new field. For example i have added one new required field so i need to add an error like the other required field (name, surname, email...) I also need an error message for the field "confirm password", when it's different from the password. Someone could help me? PS: I'm using prestashop 1.4.9 Try editing the AuthController.php file under "controllers" folder. find the line of code below if (Tools::isSubmit('submitAccount') OR Tools::isSubmit('submitGuestAccount')) { Add this line of code inside it together with the code to be executed... if (!Tools::getValue('yourinputname') {$this->errors[] = Tools::displayError('Yourinputname Input required');} Change yourinputname to your input field's name. To be safe, use prestashop's override feature to make the changes. Edited September 19, 2012 by yewster (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 20, 2012 Author Share Posted September 20, 2012 (edited) Thanks yewster, i try that but it doesn't works, i don't know if i made some mistakes or sothing else. I'm trying to make this checkbox required to register [[ EDIT ]] Edited February 24, 2021 by DARKF3D3 (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 22, 2012 Author Share Posted September 22, 2012 Someone could help me? 1 Link to comment Share on other sites More sharing options...
yewster Posted September 23, 2012 Share Posted September 23, 2012 I actually missed a ")" in my previous code. <input type="checkbox" name="privacy" id="privacy" value="1" /> For checkbox you need to do it differently. Try this for your checkbox if (Tools::getValue('privacy') != "1") {$this->errors[] = Tools::displayError('You need to check the privacy checkbox');} Insert it under if (Tools::isSubmit('submitAccount') OR Tools::isSubmit('submitGuestAccount')) In AuthController.php file under "controllers" folder. Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 23, 2012 Author Share Posted September 23, 2012 Thanks it works, but i have removed the {}: if (Tools::getValue('privacy') != "1") $this->errors[] = Tools::displayError('You need to check the privacy checkbox'); Could you also help me to add a message for the confirm password, when it isn't the same as the password? <input type="password" class="text" name="passwd_confirm" id="passwd_confirm" /> must be = to: <input type="password" class="text" name="passwd" id="passwd" /> Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 25, 2012 Author Share Posted September 25, 2012 (edited) I solved by adding this code before the privacy check: if ((Tools::getValue('passwd')) != (tools::getValue('passwd_confirm'))) $this->errors[] = Tools::displayError('Error message'); But now i have another problem, i see that if i leave empty the fields firstname and lastname in the error message list i see "firstname required" and "lastname required" 2 times, how can i fix it? Edited September 25, 2012 by DARKF3D3 (see edit history) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 29, 2012 Author Share Posted September 29, 2012 Someone could help me? Link to comment Share on other sites More sharing options...
Recommended Posts