Et en dessous il y a ce code pour checker les résultats:
<div style="font-size: 19px; font-weight: bold; display: none;" id="encours">ENVOI EN COURS...</div>
<script type="text/javascript">
function checkRequired(){
var result=true;
if(!checkField("#first_name"))
result=false;
if(!checkField("#last_name"))
result=false;
if(!checkField("#phone"))
result=false;
if(!checkField("#mobile"))
result=false;
if(!checkField("#street"))
result=false;
if(!checkField("#zip"))
result=false;
if(!checkField("#email"))
result=false;
if(!checkField("#city"))
result=false;
if(!checkField("#country"))
result=false;
return result;
}
function checkField(id){
var field=jQuery(id);
if(field.val().replace(/\s/g,"") == ""){
field.css('background-color','#FFB7B7');
return false;
}else{
field.css('background-color','#ffffff');
return true;
}
}
function check4Ent(src){
if(jQuery(src).val()=='Entreprise')
jQuery('#hiden_ent').show();
else
jQuery('#hiden_ent').hide();
}
function submitform()
{
if(checkRequired()==true){
if(jQuery("#00N200000025FqW").val()!='Entreprise'){
jQuery("#company").val(jQuery("#first_name").val()+" "+jQuery("#last_name").val());
jQuery("#sforce").hide();
jQuery("#encours").show();
}
copyform();
datastring=jQuery('#adminForm_1').serialize();
jQuery.ajax({
type: "POST",
url: "index.php",
data: datastring,
success: function() {
jQuery('#sforce').submit();
},
error:function (xhr, ajaxOptions, thrownError){
}
});
// $('adminForm_1').send();
//jQuery('#sforce').submit();
/*
jQuery('#masterc').html('Votre demande a bien été transmise et elle sera traitée dans les plus brefs délais.');
*/
}
}
function copyform(){
copyhelp('aics_name','last_name');
copyhelp('aics_firstname','first_name');
copyhelp('aics_address','street');
copyhelp('aics_postalcode','zip');
copyhelp('aics_city','city');
copyhelp('aics_country','country');
copyhelp('aics_phone','phone');
copyhelp('aics_phone2','mobile');
copyhelp('aics_email','email');
copyhelp('aics_terrain','00N200000025FpX');
copyhelp('aics_surface','00N200000025Fpc');
copyhelp('aics_environment','00N200000025FpY');
copyhelp('aics_altitude','00N200000025FqV');
copyhelp('aics_type','00N200000025FqW');
copyhelp('aics_connected','00N200000025Fph');
copyhelp('aics_abonnement','00N200000025Fpn');
copyhelp('aics_consumption','00N200000025FqG');
copyhelp('aics_invoice','00N200000025FqQ');
copyhelp('aics_abonnementcur','00N200000025Fpm');
copyhelp('aics_abonnementtype','00N200000025FpZ');
copyhelp('aics_how','00N200000025Fqk');
copyhelp('aics_companyname','company');
}
function copyhelp(src,dst){
jQuery('#'+src).val(jQuery('#'+dst).val());
}
jQuery('#first_name').keyup(function(event) {
var textBox = event.target;
var start = textBox.selectionStart;
var end = textBox.selectionEnd;
textBox.value = textBox.value.charAt(0).toUpperCase() + textBox.value.slice(1);
textBox.setSelectionRange(start, end);
});
jQuery("#phone").keypress(onlyNo);
jQuery("#mobile").keypress(onlyNo);
jQuery("#00N200000025Fpn").keypress(onlyNo);
jQuery("#00N200000025FqV").keypress(onlyNo);
jQuery("#00N200000025Fpc").keypress(onlyNo);
jQuery("#00N200000025FqG").keypress(onlyNo);
jQuery("#00N200000025FqQ").keypress(onlyNo);
jQuery("#email").keydown(noSpace);
function onlyNo(evt){
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;}
}
function noSpace(event){
if (event.keyCode ==32) {
event.preventDefault();
}
}
function montrer(){
jQuery("#facultative").fadeIn(1500, function() {$('#facultative').show();});
}
</script>