mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #362 from flamerohr/validation-fix
Remove '[' and ']' from jQuery selector for checkbox groups
This commit is contained in:
commit
3814e6c6d0
@ -125,15 +125,11 @@ jQuery(function ($) {
|
||||
// When a field becomes valid.
|
||||
success: function (error) {
|
||||
var errorId = $(error).attr('id'),
|
||||
fieldId = errorId.substr(0, errorId.indexOf('-error')),
|
||||
isCheckboxGroup = $(error).closest('.requiredField').hasClass('checkboxset');
|
||||
fieldId = errorId.substr(0, errorId.indexOf('-error')).replace(/[\\[\\]]/, '');
|
||||
|
||||
// We need to escapse the field id if it's a checkboxfield
|
||||
// because jQuery breaks when using selector that end with
|
||||
// Remove square brackets since jQuery.validate.js uses idOrName,
|
||||
// which breaks further on when using a selector that end with
|
||||
// square brackets.
|
||||
if (isCheckboxGroup) {
|
||||
fieldId = fieldId.replace('[]', '\\\\[\\\\]');
|
||||
}
|
||||
|
||||
error.remove();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user