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

Imprimir maximos y minimos en cajas de textos

Estas en el tema de Imprimir maximos y minimos en cajas de textos en el foro de Frameworks JS en Foros del Web. Buen dia amigos, estuve buscando en la web pero no encuentro enlaces de este tema que quizas me puedan ayudar por favor con lo sgte: ...
  #1 (permalink)  
Antiguo 24/09/2009, 16:00
Avatar de hoberwilly  
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Pregunta Imprimir maximos y minimos en cajas de textos

Buen dia amigos, estuve buscando en la web pero no encuentro enlaces de este tema que quizas me puedan ayudar por favor con lo sgte:

1. Tengo mi tabla simple CURSO:

IDCURSO int(2) UNSIGNED ZEROFILL No auto_increment
NOMCURSO varchar(20) latin1_swedish_ci No
MINCURSO decimal(7,2) No
MAXCURSO decimal(7,2)

2. Tengo un select opcion:

<?php
include("conec.php");
conectarse();
//////////////////////////para el select///////////////////////////////
$qryC=mysql_query("SELECT * FROM CURSO");
//////////////////////////////////////////////////////////////////////////
?>
<form name="" method="post" action="otrapagina.php">
<table>
<tr><td>
<select name="curso" style="width:200px">
<option selected="selected">Elige</option>
<?php
while($rowC=mysql_fetch_array($qryC)){
?>
<option value="<?php echo $rowC['IDCURSO'] ?>"><?php echo $rowC['NOMCURSO'] ?></option>
<?php
}
?>
</select>
</form>
</td></tr>
</table>



3. Mi requerimiento es que al momento de SELECCIONAR UN CURSO DETERMINADO, ME PINTEN en las caja de textos las notas minimas y maximas QUE LE CORRESPONDE segun la tabla cursos:

Minimo: <input type="text" name="" value="<?php echo aqui montominimo; ?>"/>
Maximo: <input type="text" name="" value="<?php echo aqui montomaximo; ?>"/>

Gracias de antemano por sus colaboraciones,
Willy S.
  #2 (permalink)  
Antiguo 24/09/2009, 23:35
Avatar de hoberwilly  
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Imprimir maximos y minimos en cajas de textos

A ver si me dan una manito, guiandome del link
http://www.forosdelweb.com/f77/relle...amente-728090/

Esto avanze:
Código php:
Ver original
  1. <body>
  2. <?php
  3. include("conec.php");
  4. conectarse();
  5. $sql= ("select ID,NOM,MIN,MAX from NOTAS");
  6. $rs=mysql_query($sql);
  7. $prov = mysql_fetch_array($rs);
  8. //echo $prov['NOM']."::~::".$prov['MIN']."::~::".$prov['MAX'];
  9. ?>
  10. <form id="frmform" name="frmform" method="post" action="">
  11. <select name='micombo' id='micombo' onChange="enviaMotivo()">
  12.     <option value='0'>Seleccione...</option>
  13. <?php
  14. while($fila=mysql_fetch_row($rs)){
  15.     echo "<option value='".$fila[0]."'>".$fila[1]."</option>";
  16. }
  17. ?>
  18. </select>
  19. Maximas:<input name="txtdato1" type="text" id="txtdato1">
  20. Minimas:<input name="txtdato2" type="text" id="txtdato2" size="10">
  21. </form>
  22. </body>
Este es mi funcion ajax:
Código php:
Ver original
  1. <script type="text/javascript">
  2. function enviaMotivo(){
  3.     var c = document.getElementById('motivo_mensaje')
  4.     var motivo = document.frmform.micombo.value;
  5.        
  6.     ajax=creaAjax();
  7.     c.innerHTML = '<img src="http://www.forosdelweb.com/f77/image/sending.gif" width="16" height="16" align="absmiddle">';
  8.     ajax.open("POST", "recibe.php",true);
  9.     ajax.onreadystatechange=function(){
  10.         if (ajax.readyState==4 && ajax.status == 200 ) {
  11.  
  12.             var respuesta=ajax.responseText;
  13.             var registro = respuesta.split('::~::');
  14.             document.frmform.txtdato1.value=registro[0];
  15.             document.frmform.txtdato2.value=registro[1];
  16.             c.innerHTML = '';
  17.         }
  18.     }
  19.     ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  20.     ajax.send("motivo="+motivo+"&control=enviado");
  21. }
  22. </script>
Y segun lo entendido tengo un php recibe:
Código php:
Ver original
  1. <?php
  2. echo $prov['NOM']."::~::".$prov['MIN']."::~::".$prov['MAX'];
  3. ?>

Espero ahora si me puedan orientar, gracias.
  #3 (permalink)  
Antiguo 26/09/2009, 02:23
Avatar de hoberwilly  
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Imprimir maximos y minimos en cajas de textos

Por favor si me pudiesen ayudar, estuve leyendo los links pero no hubo el cual sea explicativo al tema en mencion.

Tengo unas cuantas dudas:
1. Con respecto a la funcion ajax, el php recibe que estructura debe tener???
2. Como esta mi caja de texto:
<input name="txtdato1" type="text" id="txtdato1">

recibira el dato en consulta o tengo que modificarlo.

3. Que todo este codigo no cumple lo que requiero que AL SELECCIONAR EL SELECT, ME OTORGUE LA MAXIMA NOTA Y LA MINIMA DE LA BD, el cual el usuario a seleccionado.

Gracias a todos,
  #4 (permalink)  
Antiguo 30/09/2009, 19:01
Avatar de hoberwilly  
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Imprimir maximos y minimos en cajas de textos

Favor si alguna persona me pueda orientar en este tema, se lo agradeceria un monton.

Saludos,
  #5 (permalink)  
Antiguo 05/10/2009, 09:31
Avatar de hoberwilly  
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Imprimir maximos y minimos en cajas de textos

Hola a todos, de nuevo por aqui preguntando si alguna persona con ganas de colaborar en el problema en cuestion


Willy S.
  #6 (permalink)  
Antiguo 06/10/2009, 09:47
Avatar de hoberwilly  
Fecha de Ingreso: julio-2008
Ubicación: Lima - Perú
Mensajes: 769
Antigüedad: 15 años, 10 meses
Puntos: 2
Respuesta: Imprimir maximos y minimos en cajas de textos

Bueno amigos, de todas muchas gracias a todos quizas no tuvieron tiempo de responderme...pero guerreando pude dar la solucion, quizas no sea la optima pero me saco de apuro...

me base en este link:
http://foros.solocodigo.com/viewtopic.php?f=36&t=36771

y quizas a alguien k le interese y este en la misma situacion k yo, dejo en este post:

1. Este es mi body:

1.1 mi select
<select name="producto" id="producto" style="width:200px" onChange="traerDatos(formcreditos.producto.value)" >>
<option selected="selected">Elige</option>
<?php
while($rowC=mysql_fetch_array($qryC)){
?>
<option value="<?php echo $rowC['ID'] ?>"><?php echo ucfirst($rowC['NOM']); ?></option>
<?php
}
?>
</select>

1.2 Mis cajas de texto que recibiran los textos planos:

<tr>
<td width="40%" height="25"><div align="right"><u>M&iacute;nima</u>:</div></td>
<td width="60%" align="right">
<input type="text" name="txtdato2" id="txtdato2">
</td>
</tr>
<tr>
<td width="40%" height="25"><div align="right"><u>M&aacute;xima</u>:</div></td>
<td width="60%" align="right">
<input type="text" name="txtdato1" id="txtdato1">
</td>

2. Dentro del head:

function traerDatos(listaEsc){
var capa=document.getElementById("producto");
var ajax=nuevoAjax();
capa.innerHTML="Cargando...";
ajax.open("POST", "recibe.php", true);
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send("motivo="+listaEsc);
ajax.onreadystatechange=function(){
if (ajax.readyState==4) {
capa.innerHTML=ajax.responseText;
var respuesta=ajax.responseText;
var registro = respuesta.split('::~::');
document.formcreditos.txtdato1.value = registro[0];
document.formcreditos.txtdato2.value = registro[1];
}
}
}

3. Y este es mi pagina php que genera la consulta:

<?php
include("conec.php");
conectarse();
$motivo=$_POST['motivo'];
$sql=mysql_query("SELECT * FROM notas WHERE ID='$motivo'");
while($row=mysql_fetch_assoc($sql)){
echo $row['MAX']."::~::".$row['MIN'];
}
?>

Quisiera aclarar que no se mucho de ajax, que recien estoy iniciando...asi k si existiera sugernecias a este tema y a la solucion...bienvenidos... favor de postear.

Saludos,
Willy S.
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




La zona horaria es GMT -6. Ahora son las 03:41.