<script type="text/javascript">
function validate() {
var email = document.getElementById('email').value;
var phone = document.getElementById('phone').value;
var emailFilter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
var phoneFilter = /^http:\/\//;
if (!emailFilter.test(email)) {
alert('Please enter a valid e-mail address.');
return false;
}
if (!phoneFilter.test(phone)) {
alert('Please correct your phone number.');
return false;
}
return true;
}
</script>
<?php echo $form->textFieldRow($model,'login',array('class'=>'span5','type'=>'email','id'=>'email','maxlength'=>50,'labelOptions' => array('label' => false))); ?>
我已在未运行此yii框架的情况下应用了html表单 但在使用yii框架时不是