On Apr 27, 9:00 pm, "R. Rajesh Jeba Anbiah"
<[EMAIL PROTECTED]> wrote:
>     FWIW, it seems that I have patch to keep the allowEmpty as
> expected (optional). I think, allowBlank patch is unnecessary which is
> found at
> <https://trac.cakephp.org/attachment/ticket/2092/allowBlank.patch>
   <snip>
> 2. libs/view/helpers/form.php
>    i.   "required" class is added correct for div (yet to do for
> input) tag
>    ii.  validation rules are rendered in class in JSON for unobtrusive
> JavaScript validation
   <snip>

   And, dirty jQuery unobtrusive validation thing (more things to do):

$('div.input').each(function () {
    var m = /validation:{(.*)}/.exec($(this).attr('class'));
    if (m[1]) {
        $('input', $(this)).blur(function () {
            var validation = eval('({' + m[1] + '})');
            $(this).siblings('div.error-message').remove();
            if (!validation['allowEmpty'] && !$(this).val()) {
                $(this).parent().append('<div class="error-message">'
+ validation['message'] + '</div>');
            }
        });
    }
});


--
  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to