AbanteCart Community
eCommerce construction => How-to questions => Topic started by: shahiran12395 on July 17, 2019, 12:27:09 AM
-
hi guys. i want to create readonly or disable input attribute. how can i set it? i try adding 'readonly'=>true in each form array but not working
$this->data['form']['fields']['general']['phone_code'] = $form->getFieldHtml(
array (
'type' => 'input',
'name' => 'phone_code',
'value' => $phone_code,
'readonly' => true
));
-
Hello.
Try "disabled"
-
i have try it but i can still insert any value into the field. the value will be assign by js function that i have create so it doesn't need any customer input.
-
In that case try hidden input
-
is this the right way to set it? cause i still the same
$this->data['form']['fields']['general']['phonecode'] = $form->getFieldHtml(
array (
'type' => 'input',
'name' => 'phonecode',
'value' => $phonecode,
'hidden' => true
));
-
I think you should check how core engine build elements to get idea about correct values
For example https://github.com/abantecart/abantecart-src/blob/master/public_html/core/engine/html.php#L720
-
thanks..it help.. i just figure out how to make the input readonly. btw how can i display the label for the input? i cant display the label for my new input