hekan 2012-08-06 13:55:51 3180次浏览 1条回复 0 0 0
		<td><form name="form1" method="post" action="">
		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="38%"><div align="center" class="STYLE1">用户: </div></td>
    <td width="62%"><label>
                <input type="text" name="userName" id="userName">
              </label></td>
            </tr>
             <tr>
              <td width="38%" height="15"><div align="center" class="STYLE1"></div></td>
    <td width="62%"><label></label></td>
            </tr>
            <tr>
              <td><div align="center" class="STYLE1">密码:</div></td>
  <td><label>
                <input type="text" name="userPWD" id="userPWD">
              </label></td>
            </tr>
             <tr>
              <td width="38%"><div align="center" class="STYLE1"></div></td>
    <td width="62%" height="15"><label></label></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td><label>
                
              <div align="left">
                <input name="login" type="submit" id="login" value="登录">
                <input type="submit" name="reset" id="reset" value="重置">
              </div>
              </label></td>
            </tr>
          </table>
</form>

这是用HTML写的用户登录表单,怎么用到YII里面去? [attach]835[/attach][attach]834[/attach] 不要yii默认的登陆界面,用自己写的登陆界面 文本框的大小,位置都需要作调整,还要添加图片,做一个漂亮的登陆界面 HTML用到YII里,要与模型对应起来,保证登录数据能正确提交并通过验证 YII的是这样的:

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'login-form',
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
)); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'用户'); ?>
		<?php echo $form->textField($model,'username'); ?>
		<?php echo $form->error($model,'username'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'密码'); ?>
		<?php echo $form->passwordField($model,'password'); ?>
		<?php echo $form->error($model,'password'); ?>
			</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton('登陆'); ?>
	</div>
您需要登录后才可以回复。登录 | 立即注册