Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Ayuda con select dinamico

Estas en el tema de Ayuda con select dinamico en el foro de Frameworks JS en Foros del Web. Alguien puede ayudar con un select, tengo el siguiente formulario <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" ...
  #1 (permalink)  
Antiguo 25/05/2010, 21:39
 
Fecha de Ingreso: febrero-2009
Ubicación: mexico
Mensajes: 148
Antigüedad: 15 años, 2 meses
Puntos: 1
Ayuda con select dinamico

Alguien puede ayudar con un select, tengo el siguiente formulario

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="JUAN CARLOS GALVEZ OCAMPO" />
<title>Libros</title>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
<link rel="stylesheet" type="text/css" href="../css/botones_bonitos.css"/>
<link rel="stylesheet" type="text/css" href="../css/validationEngine.jquery.css"/>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/validar_campos.js" language="JavaScript"></script>
<script type="text/javascript" src="../js/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="../js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="select_autor.js"></script>
<script>
$(document).ready(function() {
$("#forma").validationEngine()//Para iniciar la validación de campos
});
</script>
<script language="javascript">
$( document ).ready( function() {//Para hacer el popup
$("a[rel='pop-up']").click(function () {
var caracteristicas = "height=200,width=400,scrollTo,resizable=1,scrollb ars=1,location=0";
nueva=window.open(this.href, 'Popup', caracteristicas);
return false;
});
});
</script>
</head>
<body>
<?php
include ("../clases/Conexion.class.php");
include ("../clases/Autor.class.php");
include ("../clases/Libro_seccion.class.php");
include ("../clases/Editorial.class.php");
?>
<center>
<form name="forma" id="forma" method="post" action="alta1.php" enctype="multipart/form-data">
<table border="1">
<tr>
<td class="titulos">CLAVE DEL LIBRO</td>
<td class="contenido"><input type="text" name="id_libro" id="id_libro" size="10" maxlength="10" class="validate[required,custom[numero_letra]] text-input" onkeypress="return permite(event,'num_car')"/></td>
</tr>
<tr>
<td class="titulos">TITULO</td>
<td class="contenido"><input type="text" name="nombre" id="nombre" maxlength="50" size="25" class="validate[required,custom[numero_letra]] text-input" onkeypress="return permite(event,'num_car')"/></td>
</tr>
<tr>
<td class="titulos">AUTOR</td>
<td class="contenido">
<select name="id_autor" id="id_autor">
<?php
$autor = new Autor();
$rs = $autor->consultar();
while ($row = $rs->fetch_assoc()) {
?>
<option value="<?php echo $row["id_autor"]; ?>"><?php echo $row["nombre"]." ".$row["apellidos"]; ?></option>
<?
}
?>
</select>
<a href="../autores/alta.php" rel="pop-up"><img src="../imagenes/Agregar.png" border="0" /></a>
</td>
</tr>
<tr class="titulos">
<td colspan="2"><input type="submit" name="Guardar" value="Guardar" class="btn btnguardar" /></td>
</tr>
</table>
</form>
</center>
</body>
</html>

Mi problema es el siguiente, como pueden ver en este formulario manejo popup en esta parte del formulario

<a href="../autores/alta.php" rel="pop-up"><img src="../imagenes/Agregar.png" border="0" /></a>

esta enlace me abre un popup para agregar un nuevo autor, pero el detalle es el siguiente, quisiera que cuando agregue un nuevo autor con el popup, automaticament se refleje o aparezca en el select ese autor que agregue, este es el select

<select name="id_autor" id="id_autor">
<?php
$autor = new Autor();
$rs = $autor->consultar();
while ($row = $rs->fetch_assoc()) {
?>
<option value="<?php echo $row["id_autor"]; ?>"><?php echo $row["nombre"]." ".$row["apellidos"]; ?></option>
<?
}
?>
</select>

quiero que al momento de agregar un nuevo autor con el popup me aparezca en la lista sin necesidad de volver a recargar el formulario o mejor dicho el archivo donde esta el formulario ayuda
  #2 (permalink)  
Antiguo 26/05/2010, 10:00
Avatar de Rod_Man_mx  
Fecha de Ingreso: agosto-2009
Mensajes: 69
Antigüedad: 14 años, 8 meses
Puntos: 4
Respuesta: Ayuda con select dinamico

Prueba con esta funcionalidad de jquery:

http://plugins.jquery.com/project/cascade

Etiquetas: dinamico, select
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 04:36.