Issue
I have written this validation rule in Model but want to validate form data without pressing submit button.
Code:
public $validate = array(
'title' => array(
'rule' => 'notEmpty'
)
);
Do i need to put these rules in function to apply javascript?
Solution
without pressing button and for processing you can do this with java script, like
<script>
var input = document.getElementsByName('title')[0];
input.onfocus = function() {
(or do anything else what you need)
this.className = 'some_class_name';
}
input.onblur = function() {
(or do anything else what you need)
this.className = '';
}
</script>
Or with jQuery or any another library used for project
Answered By - user737511 Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.