hi friends i want to customize the client side js validation.
Sorry for my english.
my scenerio is that.
i have a form for The Different Kinds of user registration . e.g (admin, client , developer), and my form used 3 different models for inseting record in database.
when user select the type of user for example if user type is developer then all form feilds are shown otherwise only some feild are shown.
all is down well but when clicked on submit button it required client side velidation for all fields including fields that are hide.
kindly some one tell how can i apply validation only on the fields that are currently shown in view.
I think you should change the controller’s rules.
public function rules()
array('FieldId, Field', 'safe', 'on'=>'search'),
Or make your own validation functions.
An example of both.
Actually, you probably need to look into Scenarios, no pun intended
thanks for reply.
but how can i change it dynamically. i meant to say on the seliction of user type in form how rules in controller will be change???
You should use AJAX and toggle() method toggle() API documentation.
The advanced search automatically generated by Gii has a similar function:
Where "search-form" is the div class:
<div class="search-form" style="display:none">