Hi all,
i want to validate a form with mootools and i use the submit function jquery for ajax response.
if i submit ... the mootools show me the error if exists, is good, but if i have this error jquery submit passing from them (error)
i want to jQuery submit when the mootools validation is correct.
this is the code
<script language="javascript" src="jquery-1.3.min.js"></script>
<script language="javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
// Mostramos el loader
jQuery().ajaxStart(function() {
jQuery('#loading').show();
jQuery('#result').hide();
}).ajaxStop(function() {
jQuery('#loading').hide();
jQuery('#result').fadeIn('slow');
});
// Enviamos el formulario
jQuery('#enviar_anuncio').submit(function() {
// Definimos el metodo ajax, los datos
jQuery.ajax({
type: 'POST',
url: jQuery(this).attr('action'),
data: jQuery(this).serialize(),
success: function(data) {
// Imprimimos la respuesta en el div result
jQuery('#result').html(data);
}
})
return false;
});
})
</script>
<script type="text/javascript" src="js/formcheck/mootools.js"></script>
<script type="text/javascript" src="js/formcheck/formcheck.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){
formcheck = new FormCheck('enviar_anuncio', {
display : {
fadeDuration : 500,
errorsLocation : 1,
indicateErrors : 1,
keepFocusOnError : 1,
flashTips : 1,
removeClassErrorOnTipClosure : 1,
showErrors : 0
}
})
});
</script>
Thanks, amic.