开发者

ZendFrame work - how to disable a text box

I am using zend_form in my project. In a form i want to disable a text box. Here is the code:

$personal_information = new Zend_Form(array(
  'method'   => 'post',
  'elements' => array(
   'first_name' => array('text', array(
    'required' => true,
    'filters'    => array('StringTrim'),
    'validators' => array(
     array('NotEmpty', true),
     array(),
     array('stringLength', false, array(1, 40))
    ),
    'decorators' => $e开发者_StackOverflowlementDecorators,
    'label' => 'First name:'
   )),
   // THE "NEXT" BUTTON
   'signup' => array('submit', array(
    'decorators' => $buttonDecorators,
    'label' => 'Next',
    'required' => false,
    'ignore'   => true,
   ))
  )
 ));

How to disable a text box in zend_form?


here is an example of disabled and readonly text field

   $lati = new Zend_Form_Element_Text("lati" , array("readonly" => "readonly"));

   $lati = new Zend_Form_Element_Text("lati" , array("disabled" => "disabled"));

i think this way is more clear than the way you add elements to the form ,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜