How do I remove the required Xiangride asterisk? First analyze the code implementation: Public Function Labelex ($model, $attribute, $htmlOptions =array ()) {return Chtml::activelabelex ($model, $ attribute, $htmlOptions);} public static function Activelabelex ($model, $attribute, $htmlOptions =array ()) {$realAttribute = $attribute; ResolveName ($model, $attribute); Strip off square brackets if any$htmloptions[' required ']= $model->isattributerequired ($attribute); return self:: Activelabel ($model, $realAttribute, $htmlOptions);} When a property is required, it renders additional CSS class tags. In particular, it calls cmodel::isattributerequired to determine if a property is required. If it is, it adds a CSS class chtml::requiredcss (public static $REQUIREDCSS = ' required ';) to the label, with Chtml::beforerequiredlabel (public static $beforeRequiredLabel = ";) and Chtml::afterrequiredlabel (public static $afterRequiredLabel = ' * ';) to decorate the label. Public Function isattributerequired ($attribute) Www.2cto.com{foreach ($this->getvalidators ($attribute) as $ Validator) {if ($validator instanceof Crequiredvalidator) return true;} return false;} So remove the asterisk or replace it with another view to redefine Chtml::requiredcss, Chtml::beforerequirEdlabel, Chtml::afterrequiredlabel can not display asterisks. Labelex ($model, ' email ');?>
http://www.bkjia.com/PHPjc/477799.html www.bkjia.com true http://www.bkjia.com/PHPjc/477799.html techarticle How do I remove the required Xiangride asterisk? First analyze the code implementation: Public Function Labelex ($model, $attribute, $htmlOptions =array ()) {return Chtml::activelabelex ($model, $ attribute,$ ...