Problems with forms in bootstrap

217 views
Skip to first unread message

Marcos Ronaldo

unread,
Aug 23, 2012, 9:37:33 PM8/23/12
to yii-bo...@googlegroups.com
Hello everybody,

I created the rules that are already working properly and created a form using the bootstrap extension.
The code is as follows:

Model Rules of User File

public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array ('usuario, senha, senha2, email', 'required','message'=>'Preenchimento Obrigatório'),
array ('senha', 'compare', 'compareAttribute'=>'senha2'),
array('usuario', 'length', 'max'=>20),
array(' email', 'length', 'max'=>200),
array('senha, senha2', 'length', 'max'=>30),
array('id, usuario, senha, email, senha2', 'safe', 'on'=>'search'),
);
}


File _form Code:


<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
'id'=>'usuario-form',
'enableAjaxValidation'=>false,
'clientOptions'=>array(
        'validateOnSubmit'=>true,
),
'inlineErrors'=>true,
)); ?>
<?php echo $form->errorSummary($model); ?>

<?php echo $form->textFieldRow($model,'usuario',array('class'=>'span5','size'=>50,'minlength'=>5,'maxlength'=>20)); ?>
<?php echo $form->error($model,'usuario');?>

<?php echo $form->passwordFieldRow($model,'senha',array('class'=>'span5','maxlength'=>20)); ?>
<?php echo $form->error($model,'senha');?>

<?php echo $form->passwordFieldRow($model,'senha2',array('class'=>'span5','maxlength'=>20)); ?>
<?php echo $form->error($model,'senha2');?>
<?php echo $form->textFieldRow($model,'email',array('class'=>'span4','prehold'=>'@')); ?>
<?php echo $form->error($model,'email');?>

<?php $this->widget('bootstrap.widgets.TbButton', array(
'buttonType'=>'submit',
'type'=>'primary',
'icon'=>'ok white',
'label'=>$model->isNewRecord ? 'Cadastrar' : 'Salvar',
)); ?>

<?php $this->endWidget(); ?>

The problem is that the error message is not displayed.
I've read and re-read the codes of the extension but do not understand why it does not work.

Anyone got a light for me?


Thank you!
Reply all
Reply to author
Forward
0 new messages