Simplifions la fonction puisque avec des id le nom du forumulaire ne sert plus :
function ver_champ(champ_id, erreur) { if(document.getElementById(champ_id).value == "") return erreur; else return ''; }
Mettons a jour l'autre partie du code
function ver_for_customers() { var msg = ''; msg += ver_champ('for_id_ins', 'Number \r'); msg += ver_champ('for_name', 'Name \r'); msg += ver_champ('for_location', 'Location \r'); msg += ver_champ('for_pricelistcode', 'Pricelistcode \r'); msg += ver_champ('for_affiliates', 'Affiliates \r'); if (msg=="") document.getElementById('form_customers').submit(); else alert('Remplissez les champs suivants: \r\r'+msg); }
Maintenant il ne reste plus qu'a attribuer a tes champs et a ton form les id respectif :
<form id="form_customers" ....><input type="text" name="for_id_ins" id="for_id_ins" ...>
Et voila
Partager