PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 22, 2022

[FIXED] how i can use onblur function in cakephp form?

 April 22, 2022     cakephp-2.0, cakephp-2.3     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing