php - Yii framwork creating and validating form input fields -
i want use html5 form inputs in yii project.
in yii framework, there no functions create type ='email' , type='tel' input fields type='text'. there function create text fields called textfield() in yii framework, once searched, have tag() function create "email" , "tel" input tags. used function in code , created input fields, problem cannot validate form fields textfield() functions.
this code:
echo chtml::tag($tagname, array('id'=>'contactus_email', 'name'=>'contactus['.$value['fieldname'].']', 'class'=>'input_height', 'type'=>'email', 'placeholder'=>$value['placeholder'] ), false, true);
as there no chtml::activetag() method, theorically bind input cactiverecord property, think can't validation on input using built-in framework classes.
however, can create own chtml , add method myhtml::activeemailfield(), same chtml::activetextfield() overwritting type=text attribute type=email.
at server-side level, make sure using cemailvalidator in model rules prevent undesired input.
Comments
Post a Comment