Jump to content

adding css class to Zend_Form_Element_Text


narjis

Recommended Posts

I want to add a form with text element

<input type='text class='txt-field-login' name='textfield' /> and button element as <div class="login-btn">
                    <input type="submit" class="login-btn" value="Login">
                </div>

So I added it as

    $email = new Zend_Form_Element_Text('UEmail');
        $email->setLabel('Email')
               ->setRequired(true)
               ->addDecorator('HtmlTag', array('tag'=>'input','class'=>"txt-field-login"));

similarly i added css to my submit button as

             

        $submit = new Zend_Form_Element_Submit('submit');

        $submit->addDecorator('HtmlTag', array('class'=>'login-btn','value'=>'Login'));

but css is not applying to my form text elements.

Please help

Try this out:

 

    $email = new Zend_Form_Element_Text('UEmail');
        $email->setLabel('Email')
               ->setRequired(true)
               ->setDecorators(array(
        array('HtmlTag',array('tag'=>'input','class'=>"txt-field-login")),
      ));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.