Jump to content

Recommended Posts

Hello,

how can I make a disabled checkbox within renderForm() function? I'm making a custom form with some basic fields. This is what I have right now when it comes to checkbox, I only need to disable it (prevent from changing its value).

array(
                'type' => 'checkbox',
                'name' => 'admin',
                'col' => 4,
                'values' => array(
                    'query' => array(
                        array(
                            'id' => 'on',
                            'name' => Context::getContext()->getTranslator()->trans('Checkbox'),
                            'val' => 1,
                        )
                    ),
                    'id' => 'id',
                    'name' => 'name',
                ),
            )

 

Link to comment
Share on other sites

4 minutes ago, WeeklyJr said:

Hello,

how can I make a disabled checkbox within renderForm() function? I'm making a custom form with some basic fields. This is what I have right now when it comes to checkbox, I only need to disable it (prevent from changing its value).


array(
                'type' => 'checkbox',
                'name' => 'admin',
                'col' => 4,
                'values' => array(
                    'query' => array(
                        array(
                            'id' => 'on',
                            'name' => Context::getContext()->getTranslator()->trans('Checkbox'),
                            'val' => 1,
                        )
                    ),
                    'id' => 'id',
                    'name' => 'name',
                ),
            )

 

Hi...
add this fields in you array

'disabled' => true,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...