submit button

Hi all,

i have orders…i when i create one order, i would like to validate if the order has some products before sending the form.

i think i have two options…in controller…and with javascript code…in submit button


<?php echo CHtml::submitButton($model->isNewRecord ? 'Crear' : 'Guardar',array('confirm'=>'Seguro que desea realizar el pedido?')); ?>

my html order has an ul with li html, so i think it would be just validating if the html element has some li before submiting the form…with jquery code…




<ul class="product-list">

    <!--<li><a>hola1<img onclick="$(this).parent().parent().remove();" alt="Borrar" src="<?php echo Yii::app()->request->baseUrl; ?>/images/gr-delete.png"><input value="1" size="3" name="number" onkeyup="this.value=this.value.replace(/\D/g,'')"></a><span class="miniTxt">Modifique encimeras</span></li>

    <li><a>hola1<img onclick="$(this).parent().parent().remove();" alt="Borrar" src="<?php echo Yii::app()->request->baseUrl; ?>/images/gr-delete.png"><input value="1" size="3" name="number" onkeyup="this.value=this.value.replace(/\D/g,'')"></a><span class="miniTxt">Modifique encimeras</span></li>

    <li><a>hola1<img onclick="$(this).parent().parent().remove();" alt="Borrar" src="<?php echo Yii::app()->request->baseUrl; ?>/images/gr-delete.png"><input value="1" size="3" name="number" onkeyup="this.value=this.value.replace(/\D/g,'')"></a><span class="miniTxt">Modifique encimeras</span></li>-->

</ul>



how can i call or use some javascript code before sending the form in the submitbutton defintion? beforesend event?

thanks in advance,