Yii Framework Forum: submit button - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

submit button vaidating before Rate Topic: -----

#1 User is offline   hibernator 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 20-February 12

Posted 28 April 2012 - 09:19 AM

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,
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users