Thread:Project:Support desk/Do not submit

Hi folks, I'm trying to develop an extension, and I can't abort the submit if the validation that I have to do returns false. The validation is being done in jscript.

This is a summary of my code.

myExtension.php: $wgOut->addScript(' ' );

..

$form = Html::openElement('form', array('method'=>'post', 'name'=>'myForm', 'id'=>'myForm', 'action'=>$this->save('action=submit'))). Html::hidden( 'title', $this->getTitle->getPrefixedText ). .. Xml::label( 'My label:', 'myLabel' ). Html::input( 'myText', '', 'textbox' ). ' ' . .. Xml::submitButton( 'Save', array( 'style' => 'width: 80px;', 'onclick' => 'clicar' ) ). ..				Html::closeElement( 'form '); $wgOut->addHTML( $form ); }
 * 1) TEXTBOX
 * 1) Submit Button

myExtension.js: function clicar { return (document.getElementById('myText').value != ''); }

How do I have to do to abort the submit? I don't want to request the server if the user doesn't fill some fields. If anyone could help me, I will be grateful.

I'm using MW 1.17.2

Thanks ;)