Combos de Recargables Dependientes
De CidesaWiki
(Diferencias entre revisiones)
(New page: Colocar esto en el form edit donde valla cada combo, donde pais es el padre y estado es el hijo <pre> <?php echo label_for('ocdatste[codpai]', __($labels['ocdatste{codpai}']), 'class="re...) |
|||
| Línea 30: | Línea 30: | ||
</div> | </div> | ||
| + | |||
| + | </pre> | ||
| + | |||
| + | |||
| + | creamos un archivo llamado comboSuccess.php donde vamos a colocar lo siguiente: | ||
| + | |||
| + | <pre> | ||
| + | |||
| + | <?php use_helper('Object', 'Validation', 'Javascript') ?> | ||
| + | |||
| + | <?php if ($tipo=='P') | ||
| + | { | ||
| + | echo select_tag('ocdatste[codedo]', options_for_select($estados,'001'),array('onChange'=> remote_function(array( | ||
| + | 'update' => 'divMunicipios', | ||
| + | 'url' => 'oycdatsol/combo?par=2', | ||
| + | 'with' => "'pais='+document.getElementById('ocdatste_codpai').value+'&estado='+this.value" | ||
| + | )))); | ||
| + | } | ||
| + | else if ($tipo=='E') | ||
| + | { | ||
| + | echo select_tag('ocdatste[codmun]', options_for_select($municipio,'001'),array('onChange'=> remote_function(array( | ||
| + | 'update' => 'divParroquia', | ||
| + | 'url' => 'oycdatsol/combo?par=3', | ||
| + | 'with' => "'pais='+document.getElementById('ocdatste_codpai').value+'&estado='+document.getElementById('ocdatste_codedo').value+'&municipio='+this.value" | ||
| + | )))); | ||
| + | } | ||
</pre> | </pre> | ||
Revisión de 14:46 30 abr 2007
Colocar esto en el form edit donde valla cada combo, donde pais es el padre y estado es el hijo
<?php echo label_for('ocdatste[codpai]', __($labels['ocdatste{codpai}']), 'class="required" ') ?>
<div
class="content<?php if ($sf_request->hasError('ocdatste{codpai}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('ocdatste{codpai}')): ?><?php echo form_error('ocdatste{codpai}', array('class' => 'form-error-msg')) ?>
<?php endif; ?> <?php echo select_tag('ocdatste[codpai]', options_for_select($pais,'001'),array('onChange'=> remote_function(array(
'update' => 'divEstados',//*****Div a Actualizar*******
'url' => 'oycdatsol/combo?par=1',//*****Variable para el control de la accion*******
'with' => "'pais='+this.value"//*****Valor de la variale de la caja de texto
))));?>
</div>
<br>
<?php echo label_for('ocdatste[codedo]', __($labels['ocdatste{codedo}']), 'class="required" ') ?>
<div class="content<?php if ($sf_request->hasError('ocdatste{codedo}')): ?> form-error<?php endif; ?>">
<?php if ($sf_request->hasError('ocdatste{codedo}')): ?> <?php echo form_error('ocdatste{codedo}', array('class' => 'form-error-msg')) ?>
<?php endif; ?>
<div id="divEstados">
<?php echo select_tag('ocdatste[codedo]', options_for_select($estados,'001'),array('onChange'=> remote_function(array(
'update' => 'divMunicipios',//*****Div a Actualizar*******
'url' => 'oycdatsol/combo?par=2',//*****Variable para el control de la accion*******
'with' => "'pais='+document.getElementById('ocdatste_codpai').value+'&estado='+this.value"//*****Valor de la variale de la caja de texto
))));?></div>
</div>
creamos un archivo llamado comboSuccess.php donde vamos a colocar lo siguiente:
<?php use_helper('Object', 'Validation', 'Javascript') ?>
<?php if ($tipo=='P')
{
echo select_tag('ocdatste[codedo]', options_for_select($estados,'001'),array('onChange'=> remote_function(array(
'update' => 'divMunicipios',
'url' => 'oycdatsol/combo?par=2',
'with' => "'pais='+document.getElementById('ocdatste_codpai').value+'&estado='+this.value"
))));
}
else if ($tipo=='E')
{
echo select_tag('ocdatste[codmun]', options_for_select($municipio,'001'),array('onChange'=> remote_function(array(
'update' => 'divParroquia',
'url' => 'oycdatsol/combo?par=3',
'with' => "'pais='+document.getElementById('ocdatste_codpai').value+'&estado='+document.getElementById('ocdatste_codedo').value+'&municipio='+this.value"
))));
}