Yii Framework Forum: How to trigger form validation without submitting the form - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

How to trigger form validation without submitting the form Rate Topic: ***** 2 Votes

#21 User is offline   Ankit Modi 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 896
  • Joined: 19-February 13
  • Location:India

Posted 20 September 2013 - 02:45 AM

View Postchuntley, on 19 September 2013 - 01:20 PM, said:

Actually it turns out that users are randomly having errors with this code, where it will say fields are not validating even though they are. If you keep changing things around it eventually disappears. I've had it happen to myself once or twice but can not recreate it anymore. Any ideas on why that might be happening?



Hi please see this forum

i hope it's some help.
Thanks,
Ankit Modi
Skype : amodi06
0

#22 User is offline   chuntley 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 23-April 10

Posted 20 September 2013 - 08:14 AM

View PostMaggie Q(Ankit Modi), on 20 September 2013 - 02:45 AM, said:

Hi please see this forum

i hope it's some help.


Unfortunately no, the form I'm working with does not actually submit, what I need to do is fire the form validation upon pressing a button that does not submit.
0

#23 User is offline   Sameera Jayasekara 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 07-April 13

Posted 16 January 2014 - 11:15 AM

View PostAndres Felipe Diaz, on 11 July 2013 - 12:31 PM, said:


With this, all the code to manually trigger validation is...

var form = $("#formId");
    var settings = form.data('settings') ;
    settings.submitting = true ;
    $.fn.yiiactiveform.validate(form, function(messages) {
        if($.isEmptyObject(messages)) { // If there are no error messages all data are valid
            $.each(settings.attributes, function () {
               $.fn.yiiactiveform.updateInput(this,messages,form); 
            });
//We update each attribute again even if there are no messages so that any error messages disappear. Good if your request takes long so the user doesn't see errors 
            successFunction();
        } else {
            // Fields acquiring invalid data classes and messages show up. Update the inputs.
            settings = form.data('settings'),
            $.each(settings.attributes, function () {
               $.fn.yiiactiveform.updateInput(this,messages,form); 
            });
            settings.submitting = false ;
        }
    });



I need to get the return value of this method. I tried to return true/false but failed. Need help
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users