Yii Framework Forum: How To Create A Client-Side Validation That Depends On Ajax Calls? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Create A Client-Side Validation That Depends On Ajax Calls? Rate Topic: -----

#1 User is offline   igorsantos07 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 29-May 10
  • Location:Rio de Janeiro, Brazil

Posted 23 May 2014 - 07:09 PM

I'm creating a validation plugin that, in the client side, will need to run an ajax call and then call messages.push() in some error callbacks.

First I ran into the issue where the form was being submitted before the ajax call was completed, and I fixed that using `async` in the call.

Now I'm having a problem where the form is submitted even thought the error callbacks are called - as if the submission and the error callbacks were running at the same time, and then yiiactiveform could not see on time the new error messages.

Is there a way to make yiiactiveform wait until I say it's ok to go ahead (like if I could say yiiactiveform.wait() in the beginning and yiiactiveform.done() inside the callbacks), or make those callbacks run smoothly in a synchronous fashion?
0

#2 User is offline   igorsantos07 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 29-May 10
  • Location:Rio de Janeiro, Brazil

Posted 27 May 2014 - 10:14 AM

If you ever search for the subject and felt in this lonely topic, take a look at the solution I proposed here: https://github.com/y...t/yii/pull/3387
0

Share this topic:


Page 1 of 1
  • 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