alleyinteractive / wordpress-fieldmanager

Custom field types for WordPress
Other
533 stars 101 forks source link

Incorrect rule key for Fieldmanager_Checkboxes validation_rules #622

Open victmo opened 7 years ago

victmo commented 7 years ago

When adding validation_rules to Fieldmanager_Checkboxes the rules key in the jQuery.validate initialization object is the "singular" name for the field when it should be added as an array:

$( '#post' ).validate( {
  ...
  rules: {
    "checkboxesfield": { // <- This doesn't work
      required: true
    },
    ...

It should be checkboxesfield[], not checkboxesfield:

$( '#post' ).validate( {
  ...
  rules: {
    "checkboxesfield[]": { // <- This works!
      required: true
    },
    ...
dlh01 commented 7 years ago

@mboynes I tentatively added this to the 1.3.0 milestone. The bug seems to affect all subclasses of Fieldmanager_Options, not just Checkboxes, so I think the fix will need some more time for testing different permutations of field settings. Additionally, the CSS for displaying validation errors next to checkboxes could use some improvement.

dlh01 commented 6 years ago

@victmo If you can, please test the branch in #673 and leave any feedback on the PR?

dlh01 commented 3 years ago

Moving some PRs with potentially breaking changes out of the 1.4 milestone so that it can be as easy as possible for sites to upgrade to 1.4, with those potential breaking changes being made available in a focused 1.5.