Skip to content
Snippets Groups Projects
Commit d15db1b5 authored by mattwire's avatar mattwire
Browse files

Fix JS crash if name is undefined

parent 9ef5e199
Branches
Tags
No related merge requests found
......@@ -372,11 +372,13 @@
// Most checkboxes get names like: "custom_63[1]" but "onbehalf" checkboxes get "onbehalf[custom_63][1]". We change them to "custom_63" and "onbehalf[custom_63]".
$('div#priceset input[type="checkbox"], fieldset.crm-profile input[type="checkbox"], #on-behalf-block input[type="checkbox"]').each(function() {
var name = $(this).attr('name');
$(this).attr('data-name', name);
$(this).attr('name', name.replace('[' + name.split('[').pop(), ''));
$(this).removeAttr('required');
$(this).removeClass('required');
$(this).removeAttr('aria-required');
if (name !== undefined) {
$(this).attr('data-name', name);
$(this).attr('name', name.replace('[' + name.split('[').pop(), ''));
$(this).removeAttr('required');
$(this).removeClass('required');
$(this).removeAttr('aria-required');
}
});
// Default email validator accepts test@example but on test@example.org is valid (https://jqueryvalidation.org/jQuery.validator.methods/)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment