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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.