- Posts: 109
- Thank you received: 5
Query of Code in Address (address/form.php)
11 years 7 months ago #189110
by Ed_Hika
Query of Code in Address (address/form.php) was created by Ed_Hika
-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
Hello, there.
Good afternoon!
I have the following query about the hikashopCheckChangeForm code when the "OK" button is clicked in the address/form.php code.
This code doesn't seem to be executed when the "OK" button is clicked.
What is the purpose of this code? When is it run?
Thanks.
Take care!
-- Joomla version -- : 3.3.6
Hello, there.
Good afternoon!
I have the following query about the hikashopCheckChangeForm code when the "OK" button is clicked in the address/form.php code.
Code:
echo $this->cart->displayButton(JText::_('OK'),'ok',$this->params,hikashop_completeLink('address&task=save'),'if(hikashopCheckChangeForm(\'address\',\'hikashop_address_form\')) document.forms[\'hikashop_address_form\'].submit(); return false;');
This code doesn't seem to be executed when the "OK" button is clicked.
What is the purpose of this code? When is it run?
Thanks.
Take care!
Please Log in or Create an account to join the conversation.
11 years 7 months ago #189147
by nicolas
Replied by nicolas on topic Query of Code in Address (address/form.php)
Hi,
I don't see why it wouldn't be executed. That code is run when you click on the button in order to check that the required data has been entered by the customer before validating the form submission.
Are you sure that you're looking at the correct view file for the correct page on your website ?
The address/form.php might not be used on the checkout based on how you configured your checkout. Instead, it could be the address/show.php which could be used.
I don't see why it wouldn't be executed. That code is run when you click on the button in order to check that the required data has been entered by the customer before validating the form submission.
Are you sure that you're looking at the correct view file for the correct page on your website ?
The address/form.php might not be used on the checkout based on how you configured your checkout. Instead, it could be the address/show.php which could be used.
Please Log in or Create an account to join the conversation.
11 years 7 months ago #189539
by Ed_Hika
Replied by Ed_Hika on topic Query of Code in Address (address/form.php)
Thanks, Nicolas.
Yes, you are right. It does get executed. Apologies for the wild goose chase.
I have another question regarding the function (or rather the hikashopCheckField function).
Instead of a popup message appearing when a validation error is found, I like the error message to be displayed inline (for instance, have the label of the input box replaced). As an example, say the post code box does not have a value and the "OK" button is clicked, the label for the post code box will now say "Please enter a value for the field Postcode".
I have modified the following code in hikashopCheckField from
to
Note that I have added the id for the label in the function getFieldName (in /administrator/components/com_hikashop/classes/field.php) as follows.
Unfortunately, the new label is not displayed. I think what I am missing is a call to the document.ready function.
Please could you direct me on how I can get the code to work to show the new label? Do I need to all the window.Oby.ready function? If so, what is the parameter to pass in?
Thanks.
Take care!
Yes, you are right. It does get executed. Apologies for the wild goose chase.
I have another question regarding the function (or rather the hikashopCheckField function).
Instead of a popup message appearing when a validation error is found, I like the error message to be displayed inline (for instance, have the label of the input box replaced). As an example, say the post code box does not have a value and the "OK" button is clicked, the label for the post code box will now say "Please enter a value for the field Postcode".
I have modified the following code in hikashopCheckField from
Code:
alert(hikashopFieldsJs['validFieldsComp'][type][i]);
to
Code:
var labelName = 'label_' + elementToCheck.id;
window.Oby.updateElem(labelName, hikashopFieldsJs['validFieldsComp'][type][i]);
Note that I have added the id for the label in the function getFieldName (in /administrator/components/com_hikashop/classes/field.php) as follows.
Code:
return '<label id="label_' .$field->field_namekey. '" for="'.$this->prefix.$field->field_namekey.$this->suffix.'">'.$this->trans($field->field_realname).$required.'</label>';
Unfortunately, the new label is not displayed. I think what I am missing is a call to the document.ready function.
Please could you direct me on how I can get the code to work to show the new label? Do I need to all the window.Oby.ready function? If so, what is the parameter to pass in?
Thanks.
Take care!
Please Log in or Create an account to join the conversation.
11 years 7 months ago #189565
by nicolas
Replied by nicolas on topic Query of Code in Address (address/form.php)
Hi,
You don't need to use Oby.ready and it wouldn't help.
The code you gave sounds correct for what you want to do.
Are you sure that labelName matches with the id of the label in the HTML ?
You don't need to use Oby.ready and it wouldn't help.
The code you gave sounds correct for what you want to do.
Are you sure that labelName matches with the id of the label in the HTML ?
Please Log in or Create an account to join the conversation.
11 years 7 months ago #190027
by Ed_Hika
Replied by Ed_Hika on topic Query of Code in Address (address/form.php)
Thanks, Nicolas.
Yes, the labels match.
I have since discovered code samples used in Hikashop on how to call the function and it (appears to) work.
Thanks.
Take care!
Yes, the labels match.
I have since discovered code samples used in Hikashop on how to call the function and it (appears to) work.
Thanks.
Take care!
Please Log in or Create an account to join the conversation.
Time to create page: 0.180 seconds