Je viens de faire ma toute première soumission de formulaire en ajax. Cette partie là fonctione (myAjax01 est une variable externe à la fonction).
CODE
$("formRecherche").addEvent("submit", function(e) {
/**
* Prevent the submit event
*/
new Event(e).stop();
/**
* This empties the log and shows the spinning indicator
*/
$("formRecherche").className = "ajax_loading_01";
/**
* send takes care of encoding and returns the Ajax instance.
* onComplete removes the spinner from the log.
*/
myAjax01 = this.send({
onComplete: function() {
formRechercheMaj (myAjax01);
}
});
});
/**
* Prevent the submit event
*/
new Event(e).stop();
/**
* This empties the log and shows the spinning indicator
*/
$("formRecherche").className = "ajax_loading_01";
/**
* send takes care of encoding and returns the Ajax instance.
* onComplete removes the spinner from the log.
*/
myAjax01 = this.send({
onComplete: function() {
formRechercheMaj (myAjax01);
}
});
});
mais je voudrais enlever le bouton submit (visuellement), et rendre les checkboxes "actives" : elles devraient déclencher la même requète ajax que si le formulaire était soumis, à chaque fois qu'une checkbox est cochée ou décochée, et cette partie là ne marche pas (j'utilise probablement la propagation d'évènement de façon incorrecte, mais je ne vois pas où).
CODE
$$("#formRecherche input").each (function (champ)
{
if (champ.type == "checkbox")
{
champ.addEvent ("click", function ()
{
$("formRecherche").fireEvent ("submit");
});
}
});
{
if (champ.type == "checkbox")
{
champ.addEvent ("click", function ()
{
$("formRecherche").fireEvent ("submit");
});
}
});
D'avance merci