- Posts: 8
- Thank you received: 1
Custom Field Validation
12 years 2 months ago #165071
by slittle
Custom Field Validation was created by slittle
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3
-- PHP version -- : 5.4.26
I've seen a few brief discussions about custom validation of custom fields... but none of them have been very helpful thus far.
I'm adept at building custom Javascript & php code and have some special validation that needs to be performed on a custom field on the checkout/registration form... I've looked and looked but can't seem to find the proper place to hack in a quick ajax call to the server to validate the field and either permit or prevent the form submitting (and displaying an error message). Suggestions?
-- Joomla version -- : 3.3
-- PHP version -- : 5.4.26
I've seen a few brief discussions about custom validation of custom fields... but none of them have been very helpful thus far.
I'm adept at building custom Javascript & php code and have some special validation that needs to be performed on a custom field on the checkout/registration form... I've looked and looked but can't seem to find the proper place to hack in a quick ajax call to the server to validate the field and either permit or prevent the form submitting (and displaying an error message). Suggestions?
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
12 years 2 months ago #165078
by Mohamed Thelji
Replied by Mohamed Thelji on topic Custom Field Validation
Hello,
Can you tell me what kind of custom field you want to use and how do you exactly want to edit it ?
Can you tell me what kind of custom field you want to use and how do you exactly want to edit it ?
Please Log in or Create an account to join the conversation.
12 years 2 months ago #165187
by slittle
Replied by slittle on topic Custom Field Validation
It's a simple text field (a number actually) into which a new user will enter a number... I need to query the database before the form is submitted to ensure that number exists in a particular table. If it does not I need to prevent Hikashop from processing the registration form and creating the new user/order until the user enters a valid number.
Please Log in or Create an account to join the conversation.
12 years 2 months ago #165296
by nicolas
Replied by nicolas on topic Custom Field Validation
Hi,
So the field is of the table "user" or "address" I guess.
In that case, you want to edit the file "registration" (or "registration_bootstrap" if you have turned on the "use bootstrap option of the configuration) via the menu Display>Views and change the line:
echo $this->cartClass->displayButton($registerButtonName,'register',$this->params,hikashop_currentUrl(),' hikashopSubmitForm(\''.$this->form_name.'\'); return false;','id="hikashop_register_form_button"');
You'll want to put the call to hikashopSubmitForm(\''.$this->form_name.'\'); in a if statement with your ajax check so that the form is sent only if your check is valid.
So the field is of the table "user" or "address" I guess.
In that case, you want to edit the file "registration" (or "registration_bootstrap" if you have turned on the "use bootstrap option of the configuration) via the menu Display>Views and change the line:
echo $this->cartClass->displayButton($registerButtonName,'register',$this->params,hikashop_currentUrl(),' hikashopSubmitForm(\''.$this->form_name.'\'); return false;','id="hikashop_register_form_button"');
You'll want to put the call to hikashopSubmitForm(\''.$this->form_name.'\'); in a if statement with your ajax check so that the form is sent only if your check is valid.
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds