welcome everybody
I have a code that works (loading) when I submit the form
But the problem is that if the field is required, it is not executed
that's good
If you finished the required fields and submitted the form, but there is an error message
For example, the description is incomplete or any other message
The message appears and the button is unfortunately working
The button should only work if all conditions are met
The other problem is that this code must be added to every requested page only
Is it possible to convert it into a job so that it works on the entire site, i.e. the Submit button?
This code
<script>
var loading = false;
$("form").on("submit", function() {
if (loading) {
return true;
}
var $window = $("window");
var $loading = $(".loading");
var css = {
"width": $window.width(),
"height": $window.height(),
"background-position": "center " + ($window.height() / 2 + document.documentElement.scrollTop) + "px"
};
$loading.css(css);
$loading.css("display", "block");
})
</script>
And This
<div class="loading"><img src="'<?php" echo osc_current_web_theme_url('images/11.gif') ; ?>' /></div>
in a more correct sense
If all are exceeded
errorLabelContainer: "#error_list",
or
Form validation
Execute the loading command
thank you