[jQuery] Problem with accordion+form+IE

[jQuery] Problem with accordion+form+IE


I all,
I have a problem with my form and ie7 when i using accordion.
The problem is that if i make an error on a field, the message error
appear, but the mail is nevertheless sent.
With Firefox and Safari, there is no problem. Just on ie7 (and before
i suppose).
If i delete the accordion function, everything be ok on ie7.
I have a second problem, on click button sent (envoyé on my form), if
a field is empty, i want open the tab where is the field empty and
focus it.
My focus works just if the tab is already open. If it closed, nothing
happened.
I post my code:
thanks for your help.
kiba.
code (formulairepro.php ) :
<?php
$email_dest = "test@gmail.com";
if ($_POST['envoi']) {
$message_remerciement = "Votre demande a bien été prise en
compte.
Nous mettons tout en œuvre afin de vous apporter une
solution dans les meilleurs délais.";
$headers ="MIME-Version: 1.0 \n";
$headers .="From: Site_test \n";
$headers .="Content-Type: text/html; charset=iso-8859-1 \n";
$subject = "formulaire PRO";
$partie_entete = "<html><head>
<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
</head>
<body bgcolor=#FFFFFF>";
$Dénomination_sociale = "<font face='Verdana' size='2'
color='#0dca03'>" . $_POST['titre_champ1'] . " = " . $_POST
['champ1'] . "</font>
";
$Date_de_creation_dentreprise = "<font face='Verdana' size='2'
color='#0dca03'>" . $_POST['titre_champ2'] . " = " . $_POST
['champ2'] . "</font>
";
$fin = "</body></html>";
$sortie = $partie_entete . $Dénomination_sociale .
$Date_de_creation_dentreprise . $fin;
if (@!mail($email_dest,$subject,$sortie,$headers)) {
echo("Envoi du formulaire impossible");
} //Se Ferme si !mail...
} //Se Ferme si edit
?>
<html>
<head>
<noscript>
<meta http-equiv="refresh" content="0;URL=javascript_missed.php">
</noscript>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>formulaire PRO</title>
<link type="text/css" href="theme/ui.all.css" rel="Stylesheet" />
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript" src="ui-core.js"></script>
<script type="text/javascript" src="jquery-ui-
personalized-1.6rc6.js"></script>
<script type="text/javascript" src="i18n/ui.datepicker-fr.js"></
script>
<script type="text/javascript">
$(function(){
$('#accordion').accordion({
header: "h3",
animated: false,
autoHeight: false
});
});
$(function() {
$('#datepicker_creation').datepicker({
changeMonth: true,
changeYear: true,
yearRange:'-100:100',
minDate: '-100Y',
maxDate: '+0Y'
});
});
$('#tabs').tabs();
$('#dialog').dialog({
autoOpen: false,
width: 600,
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#dialog_link').click(function(){
$('#dialog').dialog('open');
return false;
});
$('#slider').slider({
range: true,
values: [17, 67]
});
$("#progressbar").progressbar({
value: 20
});
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover');
},
function() { $(this).removeClass('ui-state-hover');
});
function verifSelection() {
for (var i = 0; i < 50 ;i++){
if ( mail_form.champ1.value.substring(i) == " ") {
alert ("Dénomination sociale : Un ou plusieurs espaces inutiles
en fin de saisie ont été détectés. veuillez supprimer tous les espaces
inutiles.");
mail_form.champ1.focus()
return false;
}
} if (mail_form.champ1.value == "" || mail_form.champ1.value == " ") {
alert("Dénomination sociale : ce champ est obligatoire")
mail_form.champ1.focus()
return false
} if (mail_form.champ2.value == "" || mail_form.champ2.value == " ") {
alert("Date de création entreprise : ce champ est obligatoire")
mail_form.champ2.focus()
return false
}
}
</script>
<style type="text/css">
body {
font: 62.5% "Trebuchet MS", sans-serif;
width: 616px;
margin:auto;
padding-top:20px;
padding-left:150px;
padding-right:150px;
}
.orange {
color: #FF3300
}
</style>
</head><body>
<form name="mail_form" method="post" action="<?=$PHP_SELF?>"
onSubmit="return verifSelection()" id="accordion">
<p align="center">
<?php
if ($message_remerciement) {
echo("<font face=Verdana size=2>");
echo(stripslashes($message_remerciement));
include ("remerciements.html");
echo("</body></html>");
exit();
}
?>

<div align="center">
<h3><a href="#">FICHE CONTACT ENTREPRISE</a></h3>
<div>
<div>(<span class="orange">*</span>: Champs obligatoires)</div>
</div>
</div>
<div align="left">
<h3><a href="#">VOS COORDONNEES :</a></h3>
<div>
<table align="center">
<tr>
<td><div align="right"><font face="Verdana"
size="2">Dénomination sociale<span class="orange">*</span> :</font></
div></td>
<td style="font-size:85%"><input name="champ1" type="text"
class="ui-state-highlight"></td>
</tr>
</table>
</div>
</div>
<div align="left">
<h3><a href="#">LES PERSONNES À ASSURER :</a></h3>
<div>
<div>
<table align="center">
<tr>
<td><div align="right"><font face="Verdana" size="2">Date
de création entreprise<span class="orange">*</span> :</font></div></
td>
<td style="font-size:85%"><input name="champ2" type="text"
class="ui-state-highlight" id="datepicker_creation"></td>
</tr>
<tr>
<td><div align="center">
<input name="nbre_champ_texte" type="hidden"
id="nbre_champ_texte" value="2">
<input name="titre_champ1" type="hidden"
value="Dénomination sociale">
<input name="titre_champ2" type="hidden" value="Date
de création entreprise">
</div></td>
<td style="font-size:85%"><div align="center">
<input type="submit" name="envoi" value="Envoyer">
</div></td>
</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>