How To Stop Submitbutton From Submitting

hi, i have a form. in this form, i have 3 submit buttons




                     <?php echo CHtml::submitButton('OK',array('class'=>'am-btn','name'=>'ok','id'=>$model->id));?>

                      <?php echo CHtml::submitButton('Omit',array('class'=>'am-btn','name'=>'omit'));?>

                      <?php echo CHtml::submitButton('Draft',array('class'=>'am-btn','id'=>'draftbtn','name'=>'draft')); ?>



whenever I click one of those buttons, it submits the form…what i want now is to add a pop up box, in one of those buttons, wherein, when i click the button, the pop up box with checkbox list of options will pop up, and when I submit the data from the pop up, that’s the only time the parent submit will work.but my problem is, when I tried to add a javascript stuff to one of the buttons and click it, the pop up doesn’t go out and the form gets submitted, what should i do to obtain my objective?..thanks

in your javascript function return false; to prevent the default

it doesn’t work like that




$('#id_here').click(function(){

   alert("Hello");

   return false;

});



this simple code doesn’t work on the submitButtons… now what to do?

If you don’t want to submit, why use submit buttons in the first place? :)

Like:


	<?php echo CHtml::Button('Cancel', array('submit' => Yii::app()->request->getUrlReferrer())); ?>



ok it worked…i forgot to place it inside the document ready…thanks