Hello,
I have a problem with submitting form.
I am using not a really form but validate it into Javascript and AJAX.
My form :
<form id="frmSaisie" action="javascript:void(0);" onSubmit="return false;">...
And or the FCKeditor :
<div class="form-row"> <label for="commentaire">Commentaire</label> <input name="affComm" checked="checked" style="width:50px;margin-right:10px;" type="checkbox" onclick="checkCom(this, 'frmSaisie');" /> <?php include_once("../../../fckeditor/fckeditor.php") ; $oFCKeditor = new FCKeditor('commentaire') ; $oFCKeditor->BasePath = '/fckeditor/' ; $oFCKeditor->Value = ''; $oFCKeditor->Config['EnterMode'] = 'br'; $oFCKeditor->ToolbarSet = 'Basic' ; $oFCKeditor->Create() ; ?> </div>
and the button submit :
<div class="form-row last"> <center><input id='bouton-submit' type="button" onclick="MAJAccueilQS('frmSaisie', 'colonne_page2'); return false;" value="Enregistrer" /></center> </div>
My function JS is :
function MAJAccueilQS(idForm, idDiv) { var form = document.getElementById(idForm); // Récupération de la liste des champs var champs = form.getElementsByTagName("input"); var donnees = ""; var affCom = false; // Parcours de tous les champs du formulaire for(var i=0, n=champs.length-1; i<n; i++) { if(champs[i].name == "affComm") affCom = champs[i].checked; else donnees += champs[i].name+"="+champs[i].value+"&"; } var xhr = getXMLHttpRequest(); xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { response = xhr.responseText; document.getElementById(idDiv).innerHTML = response; } else if(xhr.readyState < 4) { document.getElementById(idDiv).innerHTML = "<b>Chargement en cours...</b>"; } else { // ERREUR document.getElementById(idDiv).innerHTML = "<b>La page que vous demandez est introuvable...</b>"; } } var url = "pages/valMAJ.php"; xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send(donnees); }
When i can submit the commentaire ?
Thanks