English 中文(简体)
如何在产生形式错误的投入中添加一个特定类别?
原标题:How to add a specific class to an input which has generated a form error?

如果投入产生错误,我想在投入中增加一个具体类别。

例如,如果投入是空洞的,并且需要有效的手段,那么它就会发现:

<dd id="login-element">
    <input type="text" name="login" id="login" value="" class="input-text error" />
    <ul class="errors">
        <li>Value is required and can t be empty</li>
    </ul>
</dd>

类别=“产出”

请告诉我如何这样做。

最佳回答
问题回答

我用 j!

我使用了标准设计师,并操纵了管理局审查对象的类别。

$( ul.errors ).prev().addClass("FieldError");

这样做的方便方式不是创建决定者,而是在你加入<条码>格式类别中的内容时确定这一类别。 例如,可在<条码>init()中采用以下方法:Zend_Form。 班级

$this->addElement( text ,  email , array(
     label       =>  Your email address: ,
     required    => true,
     filters     => array( StringTrim ),
     validators  => array(
         EmailAddress ,
    ),
     class  =>  input-large 
));




相关问题
Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

Tagging with Zend Framework

I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...

dynamicaly adding textboxes to zend_form

I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...

热门标签