Yii Framework Forum: Manipulação Form - Yii Framework Forum

Jump to content

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

Manipulação Form criar form dinamico Rate Topic: -----

#1 User is offline   Genio72 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 23-August 12

Posted 11 October 2012 - 01:44 PM

Ola pessoal!!

Gostaria se possivél de uma ajuda na lógica para resolver meu problema.

Uma breve descrição.

Estou usando Rights e user

tenho o seguinte código no meu _form:

Gostaria de pegar o valor do select no campo superuser e passar como parametro na função getFieldsRegistrados();

<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'user-form',
'enableAjaxValidation'=>true,
'htmlOptions' => array('enctype'=>'multipart/form-data'),
));


?>



<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>

<?php echo $form->errorSummary(array($model,$profile)); ?>
<div id="show_dropdown_content">


</div>

<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username',array('size'=>20,'maxlength'=>20)); ?>
<?php echo $form->error($model,'username'); ?>
</div>

<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password',array('size'=>60,'maxlength'=>128)); ?>
<?php echo $form->error($model,'password'); ?>
</div>



<div class="row">
<?php echo $form->labelEx($model,'Grupo'); ?>
<?php echo $form->dropDownList($model,'superuser',CHtml::listData(Grupo::model()->findAll(), 'id', 'grupo' ),array('prompt'=>'Selecione um grupo...')); ?>
<?php echo $form->error($model,'superuser'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'email'); ?>
<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>128)); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'status'); ?>
<?php echo $form->dropDownList($model,'status',User::itemAlias('UserStatus')); ?>
<?php echo $form->error($model,'status'); ?>
</div>

<div id="dupecheck">
</div>

<?php $valor = $this->renderPartial('_ajaxContent', array('myValue'=>$myValue)); ?>

<?php

$profileFields=$profile->getFieldsRegistrados($valor);
if ($profileFields) {
foreach($profileFields as $field) {
?>
<div class="row">
<?php echo $form->labelEx($profile,$field->varname); ?>
<?php
if ($widgetEdit = $field->widgetEdit($profile)) {
echo $widgetEdit;
} elseif ($field->range) {
echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));
} elseif ($field->field_type=="TEXT") {
echo CHtml::activeTextArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
} else {
echo $form->textField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));
}
?>
<?php echo $form->error($profile,$field->varname); ?>
</div>
<?php
}
}
?>


<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save')); ?>
</div>

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

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

Abraços ,
0

#2 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 11 October 2012 - 03:12 PM

Oi, seja benvindo ao fórum!

Por favor dê mais detalhes. Eu não entendi a sua pergunta.

Quando postar código, use o botão <>, para que ele fique formatado e mais fácil de ler.
Evite também postar código em excesso. Isto pode confundir a pessoa que quer te ajudar.
0

#3 User is offline   andredelorme 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 30-April 09

Posted 13 October 2012 - 05:18 AM

Genio72,

Realmente, sua pergunta não está muito clara, acho que tem relação com esse Wiki:
http://www.yiiframew...ndent-dropdown/

Estou certo?
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