multiEdit: support validate on custom action

If requireValidation: true is set for a custom action, then only
perform action if multiEdit's form fields are valid. This does not
apply to clicking on existing rules' action buttons.

Syntax:

multiEdit: {
  fields: {
    testField: {
      custom: {
        requireValidation: true,
        ...
      },
      ...
    },
    ...
  }
}
This commit is contained in:
Brian Federle 2012-08-07 13:45:37 -07:00
parent fa2d392ba2
commit 365e8803cd
1 changed files with 5 additions and 0 deletions

View File

@ -804,6 +804,9 @@
$('<div>').addClass('button add-vm custom-action')
.html(_l(field.custom.buttonLabel))
.click(function() {
if (field.custom.requireValidation &&
!$multiForm.valid()) return false;
var formData = getMultiData($multi);
field.custom.action({
@ -816,6 +819,8 @@
}
}
});
return false;
}).appendTo($td);
} else if (field.addButton) {
$addVM = $('<div>').addClass('button add-vm').html(