News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

readonly input

Started by shahiran12395, July 17, 2019, 12:27:09 AM

Previous topic - Next topic

shahiran12395

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
            ));

Basara


shahiran12395

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.

Basara

In that case try hidden input

shahiran12395

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
            ));

Basara

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

shahiran12395

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

Forum Rules Code of conduct
AbanteCart.com 2010 -