Yii Framework Forum: [ASK]CActiveForm in Bootstrap Modal - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[ASK]CActiveForm in Bootstrap Modal Rate Topic: -----

#1 User is offline   marwin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 12-July 12
  • Location:Jakarta

Posted 21 August 2012 - 02:12 AM

Greeting’s Everyone!!!
Saya newbie dan saya memiliki problem :(
Saya memiliki sebuah Bootstrap Modal dengan CActiveForm didalamnya
Tombol submit bekerja sesuai dengan yang saya harapkan,
tetapi validasi tidak bekerja.
Jadi jika ada field yang tidak rules dimodel tidak muncul validasi apapun.
Apakah mungkin validasi pada CActiveForm bekerja pda sebuah modal Bootstrap ?
berikut code view saya...
<!-- modal for CCForm -->

<?php $this->beginWidget('bootstrap.widgets.BootModal', array('id' => 'CCForm')); ?>


<div class="modal-body">
    
    <h1>Add a new credit card</h1>
    <?php /** @var BootActiveForm $form */
    
    echo '<div class="well" style="margin-top:20px;float:left;">';
    echo '<div class="span-8">';
    
    $modelCC = new CcDetile;
    
    $form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
        'id'=>'verticalForm',
        'method'=>'post',
        'action'=> Yii::app()->createUrl('/PosItem/AddPosTransactionAndCCard'),
    )); ?>
    
                              
    <?php echo $form->dropDownList($modelCC,'cc_type_id',
                                   CHtml::listData(CcType::model()->findAll(),'id','name'),
                                        array(
                                                'prompt'=>'Choose CC',
                                                'value'=>'0',
                                             )
                );
        
    ?>
               
    	<fieldset>
		<legend>
			<p class="note">Fields with <span class="required">*</span> are required.</p>
		</legend>

	<?php echo $form->errorSummary($model,'Opps!!!', null,array('class'=>'alert alert-error span12')); ?>
    
    <?php echo $form->textFieldRow($modelCC, 'number', array('class'=>'span3')); ?>
    <?php echo $form->textFieldRow($modelCC, 'cw', array('class'=>'span3')); ?>
    <?php echo $form->textFieldRow($modelCC, 'first_name', array('class'=>'span3')); ?>
    </div>
    <div class="span-6">
    <?php echo $form->textFieldRow($modelCC, 'last_name', array('class'=>'span3')); ?>
     <label for="tanggalPicker">Expire</label>
     <div class="datetimepicker">
                    <?
                    $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                        //'dateFormat'=>'yy-mm-dd',
                        'model' => $modelCC,
                        'attribute' => 'expiry',
                        //'value'=>$model->birth_date,
                        // additional javascript options for the date picker plugin
                        'options' => array(
                            'showAnim' => 'fold',
                            'dateFormat' => 'yy-mm-dd',
                        ),
                        'htmlOptions' => array(
                            'style' => 'height:20px;',
                            'id' => 'tanggalPicker',
                        ),
                    ));
                    ?>

    </div>
    
     <div class="form-actions">
		<?php $this->widget('bootstrap.widgets.BootButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
                        
                        'icon'=>'ok white',  
			'label'=>$modelCC->isNewRecord ? 'Create' : 'Save',
		)); ?>
              <?php $this->widget('bootstrap.widgets.BootButton', array(
			'buttonType'=>'reset',
                        'icon'=>'remove',  
			'label'=>'Reset',
		)); ?>
              <?php
                    $this->widget('bootstrap.widgets.BootButton', array(
                        'label' => 'Close',
                        'url' => '#',
                        'htmlOptions' => array('data-dismiss' => 'modal'),
                    ));
                ?>
    </div>
    </fieldset>

    <?php $this->endWidget(); ?>
</div>
    </div>
</div>


<?php $this->endWidget(); ?>


Terimakasih atas tanggapannya...
0

#2 User is offline   Dayak Ngoding 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 14-November 11

Posted 23 August 2012 - 10:36 PM

Untuk kasus di Saya, khusus menampilkan record saja menggunakan cara seperti hal tersebut. Sedangkan untuk update, atau create mesti diakalin menggunakan iframe ....
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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