Closed Nicholas-Cardot closed 8 years ago
Testing with ACF:
If I delete everything from inside the validate.js file the conflict immediately goes away.
Changing:
var $form = $( '#post' ),
To:
var $form = $('#post #My_Meta_Box_ID'),
Eliminates the conflict as well. So something is clearly allowing the validation rules from this plugin to target every field on the page using the rules of this plugin.
I think that this gets us really close to the right answer, but I don't think that solution will work in a universal context. It's more a hack that makes it work for my specific use case.
Thoughts?
I'll look up the validation code and make it more precise
On Wed, May 18, 2016, 6:23 PM Nicholas Cardot notifications@github.com wrote:
Changing:
var $form = $( '#post' ),
To:
var $form = $('#post #My_Meta_Box_ID'),
Eliminates the conflict as well. So something is clearly allowing the validation rules from this plugin to target every field on the page using the rules of this plugin. Thoughts?
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/rilwis/meta-box/issues/865#issuecomment-220187139
Thanks @funkedgeek
This issue can easily be replicated by installing the free version of Advanced Custom Fields and creating at least 1 number custom field. Then navigate to a post and attempt to set that number field to any value other than zero and you'll see the validation message. That's what I did to replicate it so if you want to play around with it, that's probably the easiest way.
Hi @Nicholas-Cardot ,
Thanks a lot for reporting the bug. You are right about the problem that the validating JS runs for all inputs inside #post
which includes fields from other plugins as well.
The problem is quite complicated when the Validator library requires the form to be the selector and it queries all fields inside. I'll keep working on that to find a solution.
I'm not seeing anything specific in the code that it has to be a form element.
aaah, the submit event
@@Nicholas-Cardot: Can you please test with the fix above? I tested with simple number field from ACF and it worked.
@rilwis and @funkedgeek,
That fixed it right up for me. I kind of feel like a dummy. I can't believe that I didn't see that 'ignore' property sitting right there in front of my face. I was sooooooo close. lol
I believe that this is now solved and, as such, I would recommend closing this issue.
Thanks so much to both of you for you help on this!
I'm getting several reports that since we upgraded to the most recent version of RWMB, several users are getting validation messages for other meta plugins.
For example, one user is describing the fact that every time they try to update a post, they get a validation error on the numeric fields from ACF, but only when this is present.
I have another user who is seeing a numeric validation error on WooCommerce Membership plugin when they attempt to create a discount. They get a validation message that says, "Please enter a multiple of 0.01"
Preliminary Thoughts: Is it possible that the validations JS from this plugin is either:
If you have any ideas off the top of your head, please let me know. Otherwise, I'm going to continue to dig into this and I'll report back any information that I'm able to come up with.
Here's my plan moving forward: