redundant calling of form callbacks #260

Closed
kellerapps opened this Issue Jan 26, 2012 · 6 comments

Comments

Projects
None yet
2 participants

Shouldn't the form callbacks be called once per validation? The each loop below seems to validate the form once per field instead of once per form.

  validateForm = function(form, validators) {
    var valid;
    valid = true;
    form.trigger('form:validate:before').find('[data-validate="true"]:input:enabled').each(function() {
      if (!$(this).isValid(validators)) valid = false;
      if (valid) {
        form.trigger('form:validate:pass');
      } else {
        form.trigger('form:validate:fail');
      }
      return form.trigger('form:validate:after');
    });
    return valid;
  };

I'm running:

gem 'client_side_validations', '> 3.2.0.beta.1'
gem 'client_side_validations-mongoid', '
> 2.4.0.beta.2'

Also I noticed
https://github.com/bcardarella/client_side_validations/wiki/Callbacks
asserts one can write:

clientSideValidations.callbacks...

but one must capitalize C as in:

ClientSideValidations.callbacks...

Also, did you ever implement support for :remote=>true?

Thx, Brian. -Ken

On Thu, Jan 26, 2012 at 12:06 AM, Brian Cardarella
reply@reply.github.com
wrote:

Yes, this is fixed:

https://github.com/bcardarella/client_side_validations/blob/master/coffeescript/rails.validations.coffee#L68-72


Reply to this email directly or view it on GitHub:
bcardarella#260 (comment)

Contributor

bcardarella commented Jan 26, 2012

The changes have not been packaged in a gem yet. I want to close out a few more issues before I package.

No haven't implemented :remote => true yet

Pretty-please implement :remote=>true -- I want to implement modal
dialogs/forms. -Ken

On Thu, Jan 26, 2012 at 12:22 AM, Brian Cardarella
reply@reply.github.com
wrote:

The changes have not been packaged in a gem yet. I want to close out a few more issues before I package.

No haven't implemented :remote => true yet


Reply to this email directly or view it on GitHub:
bcardarella#260 (comment)

Contributor

bcardarella commented Jan 26, 2012

It's under way :)

If the gem can provide a function which injects an errors hash,
programmers can call it in an ajax:success handler.

On Thu, Jan 26, 2012 at 12:36 AM, Brian Cardarella
reply@reply.github.com
wrote:

It's under way :)


Reply to this email directly or view it on GitHub:
bcardarella#260 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment