MDL-54804 templates: Prevent posting when no option is selected
When no value is set for an option element and a user selects it, a POST request is made, which is incorrect. Usually that option is a placeholder value, e.g., "Choose..." - the form expecting the end user to choose an actual value.
This commit is contained in:
@@ -74,6 +74,9 @@
|
||||
{{#js}}
|
||||
require(['jquery'], function($) {
|
||||
$('#{{id}}').change(function() {
|
||||
if (!$(this).val()) {
|
||||
return false;
|
||||
}
|
||||
$('#{{formid}}').submit();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user