Yii Framework Forum: [Resolvido]Formulario Com Renderpartial - Yii Framework Forum

Jump to content

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

[Resolvido]Formulario Com Renderpartial Rate Topic: -----

#1 User is offline   Renan Lauriano 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 09-August 14

Posted 09 August 2014 - 07:49 PM

Boa noite,

estou tentando aprender a utilizar o Yii, porém estou com um problema e não achei nenhum tópico parecido.
Meu problema é o seguinte, eu tenho uma página inicial do sistema onde na parte superior(header) eu tenho um formulario de login(utilizei renderPartial, está no layout base) e no content dele eu renderizo uma view inicial, dentro dessa view eu renderizo um formulario de cadastro(também com renderPartial).
Meu problema é que ao submeter esses formularios eles não são processados, acontece um simples reload da página.

Já testei os formularios renderizando eles diretamente no content e eles funcionam normalmente.


Alguma idéia?

Formulário de cadastro
<?php
/* @var $this UsuarioController */
/* @var $model Usuario */
/* @var $form CActiveForm */

Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/js/Usuario/_form.js',CClientScript::POS_END);
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl.'/css/Usuario/_form.css');
?>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'usuario-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>True,
)); ?>

	<?php echo $form->errorSummary($model); ?>

	

	<div class="row">
		<?php echo $form->emailField($model,'EMAIL',array('size'=>50,'maxlength'=>50, 'placeholder'=>'E-mail', 'required'=>'required', 'type'=>'email')); ?>
		<?php echo $form->error($model,'EMAIL'); ?>
	</div>

	<div class="row">
		<?php echo $form->textField($model,'LOGIN',array('size'=>24,'maxlength'=>24, 'placeholder'=>'Login', 'required'=>'required')); ?>
		<?php echo $form->error($model,'LOGIN'); ?>
	</div>

	<div class="row">
		<?php echo $form->textField($model,'NOME',array('size'=>60,'maxlength'=>100, 'placeholder'=>'Nome', 'required'=>'required')); ?>
		<?php echo $form->error($model,'NOME'); ?>
	</div>

	<div class="row">
		<?php echo $form->dropDownList($model, 'SEXO', CHtml::listData(Sexo::model()->findAll('CODIGO_SEXO'), 'CODIGO_SEXO', 'DESCRICAO_SEXO'), array('required'=>'required')); ?>
		<?php echo $form->error($model,'SEXO'); ?>
	</div>

	<div class="row">
	<?php 
		$this->widget('zii.widgets.jui.CJuiDatePicker', array(
	    'model' => $model,
	    'attribute' => 'DATA_DE_NASCIMENTO',
		'language'=> 'pt',
	    'htmlOptions' => array(
	        'size' => '10',         // textField size
	        'maxlength' => '10',    // textField maxlength
			'placeholder'=>'Data de nascimento',
			 'required'=>'required',
	    ),
	));
	?>
	
		<?php echo $form->error($model,'DATA_DE_NASCIMENTO'); ?>
	</div>

	<div class="row">
		<?php echo $form->passwordField($model,'SENHA',array('size'=>60,'maxlength'=>100, 'placeholder'=>'Senha', 'required'=>'required')); ?>
		<?php echo $form->error($model,'SENHA'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->passwordField($model,'CONFIRMAR_SENHA',array('size'=>60,'maxlength'=>100, 'placeholder'=>'Confirmar senha', 'required'=>'required')); ?>
		<?php echo $form->error($model,'SENHA'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->dropDownList($model,'MODALIDADE',CHtml::listData(Modalidade::model()->findAll('CODIGO_JOGO'), 'CODIGO_JOGO', 'DESCRICAO_JOGO')); ?>
		<?php echo $form->error($model,'MODALIDADE'); ?>
	</div>
	

	<div class="row label_checkbox">
		<?php echo $form->checkBox($model, 'ASSOCIAR_DADOS_RIOT').$form->label($model, 'ASSOCIAR_DADOS_RIOT'); ?>
		<?php echo $form->error($model,'ASSOCIAR_DADOS_RIOT'); ?>
	</div>

	<div class="row riot_reg2">
		<?php echo $form->textField($model,'LOGIN_RIOT',array('size'=>24,'maxlength'=>24, 'placeholder'=>'Login RIOT')); ?>
		<?php echo $form->error($model,'LOGIN_RIOT'); ?>
	</div>

	<div class="row riot_reg2">
		<?php echo $form->textField($model,'NICKNAME_RIOT',array('size'=>50,'maxlength'=>50, 'placeholder'=>'Nickname RIOT')); ?>
		<?php echo $form->error($model,'NICKNAME_RIOT'); ?>
	</div>

	<div class="row dota_reg">
		<?php echo $form->textField($model,'NIVEL_DOTA',array('size'=>3,'maxlength'=>3, 'placeholder'=>'Nivel DOTA2')); ?>
		<?php echo $form->error($model,'NIVEL_DOTA'); ?>
	</div>

	<div class="row dota_reg">
		<?php echo $form->textField($model,'NICKNAME_STEAM',array('size'=>50,'maxlength'=>50, 'placeholder'=>'Nickname Steam')); ?>
		<?php echo $form->error($model,'NICKNAME_STEAM'); ?>
	</div>



	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? ('Registrar') : 'Salvar', array('class'=>'botao')); ?>
	</div>

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

</div><!-- form -->


View onde estou renderizando:
	<div id="esquerda">
    	  <div id="infos">
        
		<div id="cabecalho_registro">

        	</div>
        	<div id="form_registro">
			<?php 
				$model = new Usuario;
				$this->renderPartial('/usuario/_form', array('model'=>$model));
		        ?>
       		</div>
	  </div>
          <div id="infos_serv">
          </div>
	</div>     

0

#2 User is offline   alexFidelis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 17-November 11

Posted 10 August 2014 - 04:37 PM

No widget do formulário coloca a URL de onde processa os dados enviados.
0

#3 User is offline   Renan Lauriano 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 09-August 14

Posted 14 August 2014 - 06:16 PM

View PostalexFidelis, on 10 August 2014 - 04:37 PM, said:

No widget do formulário coloca a URL de onde processa os dados enviados.

Muito obrigado.
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