beamsjr
(Beamsjr)
September 1, 2011, 7:04pm
1
I am trying to populate a field to set the Company ID automatically, everything looks right, but it does not work… Am I on the right track here? Also, how would I make this field hidden?
<div class="row">
<?php echo $form->labelEx($model,'ID_COMPANY'); ?>
<?php echo CHtml::textField($model['ID_COMPANY'], $thisCompID); ?>
<?php echo $form->error($model,'ID_COMPANY'); ?>
</div>
tri
(tri - Tommy Riboe)
September 1, 2011, 7:58pm
2
beamsjr:
I am trying to populate a field to set the Company ID automatically, everything looks right, but it does not work… Am I on the right track here? Also, how would I make this field hidden?
<div class="row">
<?php echo $form->labelEx($model,'ID_COMPANY'); ?>
<?php echo CHtml::textField($model['ID_COMPANY'], $thisCompID); ?>
<?php echo $form->error($model,'ID_COMPANY'); ?>
</div>
CHtml::activeTextField is what you are looking for. Just initialize the model instance with the values you want.
/Tommy
beamsjr
(Beamsjr)
September 1, 2011, 8:11pm
3
Thanks, I guess I actually needed CHtml::activeHiddenField to make it hidden!