Hi, I am a php programmer starting to get into javascript quite a bit more.
I am having an issue understanding some basics.
i have the following. I am using mootools for my framework. my problem seems to be that both my validator and my asynchronous request run off the submit action for the form. So i believe my problem to be even propagation. I need to check if my form is valid, and if true then continue on with the submit request. However I have no idea how to do this in javascript.
I have alerted out my validator function that will return a true/false depending on if my form is valid or not. I do not know how to arrange my script below to do an if true then continue.
<script type="text/javascript">
// start form validator
var myValidator = new fValidator("create_category_form");
//add submit event.
$('create_category_form').addEvent('submit', function(e) {
new Event(e).stop();
alert(myValidator. _checkSubmit());
$('log').setStyle('display', 'none');
$('log_res').setStyle('display', 'block');
this.send({
onComplete: function() {
$('log_res').setStyle('display', 'none');
$('success').setStyle('display', 'block');
}
});
});
</script>