Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/06/2011, 11:54
marlon5445
 
Fecha de Ingreso: julio-2010
Mensajes: 45
Antigüedad: 14 años, 5 meses
Puntos: 3
Respuesta: Codeigniter: CRUD y validaciones

Bueno ya encontre una posible solucion por si alguien tiene un problema similar.

View:

Código PHP:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><?php echo $title?></title>
    </head>
    <body>
      <form method="post" action="<?php echo $action?>">
          
        <table align="center">

            <tr>
                            <td>Codigo PUCP:</td>
                            <td><input type="text" name="codigoPucp" value="<?= isset($user) ? set_value('codigoPucp',$user->codigoPucp) : set_value('codigoPucp'); ?>" /></td>
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('codigoPucp'); ?></td>
                        </tr>
            <tr>
                            <td>Nombre:</td>
                            <td><input type="text" name="nombre" value="<?= isset($user) ? set_value('nombre',$user->nombre) : set_value('nombre'); ?>" /></td>    
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('nombre'); ?></td>
                        </tr>
                        <tr>
                            <td>Apellidos:</td>
                            <td><input type="text" name="apellidos" value="<?= isset($user) ? set_value('apellidos',$user->apellidos) : set_value('apellidos'); ?>" /></td>    
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('apellidos'); ?></td>
                        </tr>
                        <tr>
                            <td>Email PUCP:</td>
                            <td><input type="text" name="emailPucp" value="<?= isset($user) ? set_value('emailPucp',$user->emailPucp):set_value('emailPucp'); ?>" /></td>
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('emailPucp'); ?></td>
                        </tr>
                        <tr>
                            <td>Confirmar Email:</td>
                            <td><input type="text" name="confEmail" value="<?= isset($user) ? set_value('confEmail',$user->emailPucp):set_value('confEmail'); ?>" /></td>    
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('confEmail'); ?></td>
                        </tr>
                        <tr>
                            <td><input type="radio" name="sexo" value="M" <?= set_radio('sexo',"M");  ?> <?php echo (isset($user) && $user->sexo=="M" ) ? ' checked="checked"'''?> />Maculino</td>
                            <td><input type="radio" name="sexo" value="F" <?= set_radio('sexo'"F"); ?> <?php echo (isset($user) && $user->sexo=="F" ) ? ' checked="checked"'''?> />Femenino</td>        
            </tr>
                        <tr>
                            <td>Usuario:</td>
                            <td><input type="text" name="usuario" value="<?= isset($user) ? set_value('usuario',$user->usuario):set_value('usuario'); ?>" /></td>
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('usuario'); ?></td>
                        </tr>
                        <tr>
                            <td>Contrase&ntilde;a:</td>
                <td><input type="password" name="password" value="<?= isset($user) ? set_value('password',$user->password):set_value('password'); ?>" /></td>    
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('password'); ?></td>
                        </tr>
                        <tr>
                            <td>Confirmar Contrase&ntilde;a:</td>
                            <td><input type="password" name="confPassword" value="<?= isset($user) ? set_value('confPassword',$user->password):set_value('confPassword'); ?>" /></td>
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('confPassword'); ?></td>
                        </tr>
                        <tr>
                            <td>Tel&eacute;fono M&oacute;vil:</td>
                            <td><input type="text" name="telefono" value="<?= isset($user) ? set_value('telefono',$user->telefono):set_value('telefono'); ?>" /></td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('telefono'); ?></td>
                        </tr>
                        <tr>
                            <td><input type="checkbox" name="mostrarTelefono" value="1" <?= set_checkbox('mostrarTelefono'1); ?> <?php echo (isset($user) && $user->mostrarTelefono==) ? ' checked="checked"'''?> />Deseo mostrar mi<br />
                                tel&eacute;fono m&oacute;vil</td>
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('mostrarTelefono'); ?></td>
                        </tr>
                        <tr>
                            <td><input type="checkbox" name="aceptoCond" value="S" <?php echo set_checkbox('aceptoCond','S'); ?> <?php echo (isset($user)) ? ' checked="checked"'''?> />Acepto la condiciones <br />
                                generales de uso</td>
            </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><?= form_error('aceptoCond'); ?></td>
                        </tr>
            <tr>
                <td>&nbsp;</td>
                <td><input type="submit" value="GUARDAR"/></td>
            </tr>
                </table>
      </form>
    </body>
</html>

Bueno la variable $user es enviado en la primera carga del formulario para su edicion en las posteriores llamadas por la validacion ya no se envia esta variable para evitar un mal funcionamiento.

y bueno esa es la solucion que encontre