I have a module and I’m doing login form for the module. This is the code for login view:
<?php
$form = $this->beginWidget(‘CActiveForm’, array(
'id' => 'login-form',
'enableClientValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
),
));
?>
<div class="row ri">
<?php echo $form->label($model, 'username', array('class' => 'leftlabel')); ?>
<div class="fakeInput"><?php echo $form->textField($model, 'username'); ?></div>
<?php echo $form->error($model, 'username'); ?>
</div>
<div class="row ri">
<?php echo $form->label($model, 'password', array('class' => 'leftlabel')); ?>
<div class="fakeInput"><?php echo $form->passwordField($model,'password'); ?></div>
<?php echo $form->error($model, 'password'); ?>
</div>
<div class="ovh">
<?php echo $form->error($model, 'messages'); ?>
</div>
<div class="row rememberMe">
<div class="leftside">
<?php echo $form->checkBox($model,'rememberMe'); ?>
<?php echo $form->label($model,'rememberMe', array('class'=>'lblremember')); ?>
<?php echo $form->error($model,'rememberMe'); ?>
</div>
<?php echo CHtml::submitButton('Login', array('class'=>'btnLogin')); ?>
</div>
<?php $this->endWidget(); ?>
My question is: why I can’t get the post value from the form? I viewed the page source code it has something like: <input name=“LoginForm[username]” id=“LoginForm_username” type=“text” maxlength=“30”> and I always get null POST value from the form but when I change the input name to <input name=“username” …> I can get the value from the form.
Anyone has any idea how to solve this?
Thanks