PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 22, 2022

[FIXED] How to disable input tag in cakephp

 April 22, 2022     cakephp-2.0, cakephp-2.1, cakephp-2.3     No comments   

Issue

I want to disable input tag ,my demo code is

echo $this->Form->input('AreaMaster.GroupID', array('type'=>'select', 'div'=>'control-group', 
                    'cascadeFrom'=>'AreaMasterAreaType012',  'label'=>array('text' => 'Area Group','class'=>'control-label required'),'tabindex'=>'4', 'autoBind' => false,
                        'options'=>$dataSource, 'disabled' => 'true'));

I applied 'disabled' => 'true' but it not work . So please suggest me appropriate solution..


Solution

You are using 'disabled' => 'true' (notice the single quotes you have around true. This may have been the reason. I am using CakePHP 2.3 and it's working fine however.

You can also use any of the following:

'disabled'
'disabled' => 'disabled'
'disabled' => true

So your code would look like one of these:

echo $this->Form->input('AreaMaster.GroupID', array('type'=>'select', 'div'=>'control-group', 
                    'cascadeFrom'=>'AreaMasterAreaType012',  'label'=>array('text' => 'Area Group','class'=>'control-label required'),'tabindex'=>'4', 'autoBind' => false,
                        'options'=>$dataSource, 'disabled'));

echo $this->Form->input('AreaMaster.GroupID', array('type'=>'select', 'div'=>'control-group', 
                    'cascadeFrom'=>'AreaMasterAreaType012',  'label'=>array('text' => 'Area Group','class'=>'control-label required'),'tabindex'=>'4', 'autoBind' => false,
                        'options'=>$dataSource, 'disabled' => 'disabled'));

echo $this->Form->input('AreaMaster.GroupID', array('type'=>'select', 'div'=>'control-group', 
                    'cascadeFrom'=>'AreaMasterAreaType012',  'label'=>array('text' => 'Area Group','class'=>'control-label required'),'tabindex'=>'4', 'autoBind' => false,
                        'options'=>$dataSource, 'disabled' => true));                                                    


Answered By - bigmike7801
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing