I ham having troubles below and I am new to javascript. basically I am using mootools to send a form using ajax. I also am using a formValidator class.
the problem is both of the things i need to do require the form id name. which is "create_category_form" when i have both, only one will work. Any ideas how i can get both actions to work? what i would like is that my form validator fires first and if ok move on to my submit event.
<script type="text/javascript">
/** this validates my form and makes sure what is required is entered
var myValidator = new fValidator("create_category_form");
$('create_category_form').addEvent('submit', function(e) {
new Event(e).stop();
/**
* This empties the log and shows the spinning indicator
*/
$('log').setStyle('display', 'none');
$('log_res').setStyle('display', 'block');
/**
* send takes care of encoding and returns the Ajax instance.
* onComplete removes the spinner from the log.
*/
this.send({
onComplete: function() {
$('log_res').setStyle('display', 'none');
$('success').setStyle('display', 'block');
}
});
});
</script>