Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesnt work in 2.2.4 #1

Open
gerlstar opened this issue Jan 8, 2013 · 2 comments
Open

doesnt work in 2.2.4 #1

gerlstar opened this issue Jan 8, 2013 · 2 comments

Comments

@gerlstar
Copy link

gerlstar commented Jan 8, 2013

Hey I tried this with my version 2.2.4 but it looks like it's still validating serverside. CAn you please fix it?

@vz28bh
Copy link
Owner

vz28bh commented Jan 10, 2013

Hi, thanks for trying it out. Try updating one section of code after line 98 by updating to match this:

    $meta = $this->meta($model, $fieldName);
    $formatted_js = strtr($this->js, $map);
    $boolean_fix_map = array(
        '"true"' => 'true',
        '"false"' => 'false',
    );
    $options['data-validate'] = strtr(json_encode($meta, JSON_NUMERIC_CHECK), $boolean_fix_map);
    $response = $this->_addJs($map);

There is a problem with the way the metadata encodes booleans so I had to make an ugly hack to fix it. I have a project in 2.2.4 that works correctly so hopefully that is the only issue. Make a simple test first with a dialog that just has one field that should be numeric, then type an 'a' in the field and it should show an error message immediately.

I will make a commit on this shortly.

@aymanrb
Copy link

aymanrb commented Dec 1, 2013

I am not sure if this worked for @gerlstar or not but it didn't work for me too.

After debugging for sometime on why it didn't work it turned out that JQueryValidation Plugin has dropped support for metadata plugin (that your helper relies on the most) - http://goo.gl/AY6omU

The class should use 'data-rule-' and 'data-msg-' instead 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants