<?php
Yii::app()->clientScript->registerScript('submit', '
$(document).ready( function() {
   $("#submit_button").click(function() {
      $(this).prop("disabled",true)
         .parents("form").submit();
      });
})
');
?>

<div class="form">

<?php $form = $this->beginWidget('GxActiveForm', array(
    'id' => 'fornecedores-form',
    'enableAjaxValidation' => false,
    'focus'=>array($model,'FOR_NOME'),
));
?>

    <?php echo FaHtml::getFormInfo($form, $model); ?>

        <div class="row">
        <?php echo $form->labelEx($model,'FOR_NOME'); ?>
        <?php echo $form->textField($model, 'FOR_NOME', array('maxlength' => 50)); ?>
        <?php echo $form->error($model,'FOR_NOME'); ?>
        </div><!-- row -->
        <div class="row">
        <?php echo $form->labelEx($model,'FOR_IDREVENDA'); ?>
        <?php echo $form->dropDownList($model, 'FOR_IDREVENDA', GxHtml::listDataEx(Revendas::model()->findAll('REV_SITUACAO="A" order by REV_NOME')),
            array(
                'prompt' => 'Selecione',
                'ajax' => array(
                    'type'=>'POST',
                    'url'=>CController::createUrl('cidades/DynamicCidade'),
                    'update'=>'#Fornecedores_FOR_IDCIDADE'
                )
            )
        ); ?>
        <?php echo $form->error($model,'FOR_IDREVENDA'); ?>
        </div><!-- row -->

        <div class="row">
        <?php echo $form->labelEx($model,'FOR_IDCIDADE'); ?>
        <?php
            $data = GxHtml::listDataEx(Regioescidades::model()->findAll(array('condition'=>'RCD_IDREVENDA=:x', 'params'=>array(':x'=>$model->FOR_IDREVENDA))), 'RCD_IDCIDADE', 'CidadeEstado');
            natcasesort($data);
        ?>
        <?php echo $form->dropDownList($model, 'FOR_IDCIDADE', $data, array('prompt'=>'Selecione')); ?>
        <?php echo $form->error($model,'FOR_IDCIDADE'); ?>
        </div><!-- row -->

        <div class="row">
        <?php echo $form->labelEx($model,'FOR_SISTEMA'); ?>
        <?php echo $form->textField($model, 'FOR_SISTEMA', array('maxlength' => 40)); ?>
        <?php echo $form->error($model,'FOR_SISTEMA'); ?>
        </div><!-- row -->
        <div class="row">
        <?php echo $form->labelEx($model,'FOR_HOMEPAGE'); ?>
        <?php echo $form->textField($model, 'FOR_HOMEPAGE', array('maxlength' => 50)); ?>
        <?php echo $form->error($model,'FOR_HOMEPAGE'); ?>
        </div><!-- row -->
        <div class="row">
        <?php echo $form->labelEx($model,'FOR_SITUACAO'); ?>
        <?php echo $form->dropDownList($model, 'FOR_SITUACAO', array('A' => 'Ativo','I' => 'Inativo')); ?>
        <?php echo $form->error($model,'FOR_SITUACAO'); ?>
        </div><!-- row -->

<?php
echo FaHtml::saveButton();
$this->endWidget();
?>
</div><!-- form -->