FIpValidator verifies if the attribute is a valid IP address.
In the model we use:
public function rules() { return array( //allow ipv4 and ipv6 //array('<attributeName>', 'ext.validators.FIpValidator'), //allow only ipv4 //array('<attributeName>', 'ext.validators.FIpValidator','version'=>'ipv4','enableClientValidation'=>true), //allow only ipv6 array('<attributeName>', 'ext.validators.FIpValidator','version'=>'ipv6'), ) }
| Parameter | Default value | Comment |
| attributes | list (array)) of attributes to be validated | |
| message | the user-defined error message | |
| skipOnError | false | whether this validation rule should be skipped if when there is already a validation error for the current attribute |
| on | List of scenarios that the validator should be applied. Each array value refers to a scenario name with the same name as its array key. | |
| safe | true | whether attributes listed with this validator should be considered safe for massive assignment |
| enableClientValidation | true | whether to perform client-side validation |
| allowEmpty | true | whether the attribute value can be null or empty |
| version | 'both' | the IP Protocol version to validate against |
Total 1 comment
volkmar is a hero. Thanks!
Leave a comment
Please login to leave your comment.