(01-16-2025, 11:20 AM)michalsn Wrote: A much cleaner way would be using
for your button, and then something like:
Code:
$("#myform").submit(function(e) {
e.preventDefault();
var scegli_materiali = $("#scegli-materiali").val();
var quantita = $("#id_class_quantita").val();
if (scegli_materiali == "") {
alert('Scegli un codice!!!!');
} else if (quantita == '') {
alert('Inserisci una quantità');
} else {
$("#bottone_invio_form").prop("disabled", true);
$("#bottone_invio_form").hide();
$("#gif_animata").show();
// Proceed with form submission
this.submit();
}
});
Anyway, for your existing code - try to add this in your final condition:
Code:
$(this).prop("disabled", true);
$(this).hide();
$("#gif_animata").show();
$("#myform").submit();
Oh... and consider whether it's worth taking advantage of the native validation you get when you use "required" tags in your input forms.
But I expect you have a reason for doing it the way you are doing it now.
hi , i think that with this code i cannot resolve double insert on db , i must insert a validation to control if data with determinate condition are sending to db and if the time is equals i don't insert record...
i also think that ci developer must create a standard validation to prevent this by passing an array of value to control (with created_at).