OnPreSubmit validations firing during remove()?
OnPreSubmit validations firing during remove()?
Hi there,
I'm using some example code to create an inline Delete button. I've got some validation code for my form elements in the OnPreSubmit event in my editor. The removal code looks like this:
[code]
$('#users').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
editor.remove( $(this).parents('tr')[0], 'Delete this user?', {
"label": "Confirm",
"fn": function () { this.submit(); }
}
);
});
[/code]
...the onPreSubmit event fires. This means that any user that hasn't been entered into the system under the same parameters as the validation can't be deleted. Is there a way to suppress the onPreSubmit event only in the instances when submit() is called during a remove()?
I'm using some example code to create an inline Delete button. I've got some validation code for my form elements in the OnPreSubmit event in my editor. The removal code looks like this:
[code]
$('#users').on('click', 'a.editor_remove', function (e) {
e.preventDefault();
editor.remove( $(this).parents('tr')[0], 'Delete this user?', {
"label": "Confirm",
"fn": function () { this.submit(); }
}
);
});
[/code]
...the onPreSubmit event fires. This means that any user that hasn't been entered into the system under the same parameters as the validation can't be deleted. Is there a way to suppress the onPreSubmit event only in the instances when submit() is called during a remove()?
This discussion has been closed.
Replies
The object "e" has a property "action". If this value of the action property is "remove", I just short-circuit the whole event and return true.
Good to hear that you found a solution to this. Just one moment to make - it should actually be 'data' (the second argument) which as the 'action' property. The first arguments the event that is being triggered (typically a mouse click), while the second one is what is going to be sent to the server (so it can be manipulated if needed).
Regards,
Allan