Ver Mensaje Individual
  #8 (permalink)  
Antiguo 04/09/2003, 02:27
bomaye
 
Fecha de Ingreso: septiembre-2003
Ubicación: Madrid
Mensajes: 53
Antigüedad: 20 años, 8 meses
Puntos: 1
Primero:

josemi: Es una tabla bastante grande, osea que si me dices que no me lo aconsejas en caso de tablas grandes, no se, de todas maneras lo voy a probar y os respondo si funciona.
De todas maneras, me da igual que se recarge la página, pero si esto no provoca que se me borren el resto de campos y luego puedo obligarlo de alguna manera a cargar el tratamiento en la otra hoja. "alta2.php" . a la que llama el formulario.

Segundo:

mveraa: el select 1 en pag1 llama al select 2 en pag1. y los valores estos, más otros de otros campos van a la pag2 dónde se ejecuta un script php que trata los valores del formulario.

Gracias.

Aquí va el código completo que funciona, menos esto.

<html>
<HEAD>
<link href="../estilos.css" rel="stylesheet" type="text/css">
<TITLE>POR F!N YA</TITLE>
<?php
$dbli = mssql_connect("172.16.0.10","usuarioweb","fuensant a");

if ($dbli > 0)
{
$dbs = mssql_select_db("porfinya",$dbli);
}
?>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- hide JavaScript code from browsers that are not JavaScript enabled

function valid1(form) {
var field = form.finicio;
var str = field.value;
var reg1 = /(\d{4})-(\d{2})(-(\d{2}))/;
var reg2 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
if (!reg1.test(str) && reg2.test(str)) {
return true;
}
return false;
}

function valid2(form) {
var field = form.ffin;
var str = field.value;
var rega = /(\d{4})-(\d{2})(-(\d{2}))/;
var regb = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
if (!rega.test(str) && regb.test(str)) {
return true;
}
return false;
}

function checkform() {

var message = ""; // create error message string variable, with nothing in it


// Check el teléfono
if (document.datostelefono.telefono.value.length == 0) {
message = message + "Por favor, introduzca un número de teléfono!\n";
}
else if (document.datostelefono.telefono.value.length < 9) {
message = message + "El número de teléfono debe contener mínimo 9 números!\n"
}
else if (isNaN(document.datostelefono.telefono.value)) {
// test for numeric digits only
message = message + "El teléfono debe contener solo datos numéricos\n";
}

// Check finicio
if (document.datostelefono.finicio.value.length == 0) {
message = message + "Por favor, introduzca la fecha de inicio!\n";
}
/*else if (! valid1(document.datostelefono)){
message = message + "El formato fechaincio es yyyy-mm-dd!\n";
}*/

// Check ffin
/*if (document.datostelefono.ffin.value.length !=0){
if (! valid2(document.datostelefono)){
message = message + "El formato fechafin es yyyy-mm-dd!\n";
}
}*/

if ( message.length > 0 ) { // is there an error message?
alert( message ); // display error message
return false; // return bad, not ok to process
}
else {
return true; // no error message to display,
}

} // end of the function checkform()




//end hiding of JavaScript code -->
</SCRIPT>

</HEAD>
<BODY onLoad="document.datostelefono.telefono.focus();">
<table width="100%" border="0" style="font-size:12px" cellspacing="2">
<tr>
<td valign="top">
<h3><strong>Alta</strong></h3>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top">
</td>
<td valign="top">
<center>
<table border="1" align="top" cellspacing="0" cellpadding="6" class="bordeazul">
<tr>
<td class="tdwhite">
Formulario de alta
</td>
</tr>
<tr>
<td>
<table border="0" align="top" >
<form name="datostelefono" action="alta2.php" onsubmit="return checkform();" method="POST" >
<tr>
<td>Tel&eacute;fono</td>
<td>Empresa</td>
</tr>
<tr>
<td><input name="telefono" type="text" size="36" maxlength="15" title="Introduzca el teléfono completo de su empresa"></td>
<td><select name="empresa" >

<?php

if ($dbs)
{
$resultado = mssql_query("SELECT nombre from EMPRESA");
while ($linea=mssql_fetch_row($resultado)) {

echo ("<option>".$linea[0]."</option>\n");
}
}
?>


</select></td>

</tr>
<tr>

<td>Operadora</td><td>Tarifa</td>
</tr>
<tr>
<td><select name="operadora" >
<option selected value=" ">--Eliga una operadora--</option>


<?php
$resultado = mssql_query("SELECT nombre from OPERADORA");
while ($linea=mssql_fetch_row($resultado)) {
echo ("<option>".$linea[0]."</option>\n");
}
?>
</select></td>
<td><select name="tarifa">
<option selected value=" ">--selecciona tarifa--</option>

<?php


$resultado = mssql_query ("select nTarifa from tarifa ");

while ($linea=mssql_fetch_row($resultado)) {
echo ("<option>".$linea[0]."</option>\n");
}

mssql_close($dbli);
?>
</select></td>
</tr>
<tr>
<td>Fecha de inicio</td>
<td>Fecha final</td>
</tr>
<tr>
<td><input name="finicio" type="text" value=" aaaa-mm-dd" size="36" maxlength="50" title="Introduzca la fecha de comienzo de aplicaci&oacute;n de la tarifa."></td>
<td><input name="ffin" type="text" value=" aaaa-mm-dd" size="36" maxlength="50" title="Introduzca la fecha de finalizaci&oacute;n de aplicaci&oacute;n de la tarifa." ></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right"><br><input name="Submit" type="submit" value="ACEPTAR" ></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</Center>
</td>
</tr>
</table>
<br><br>
<hr width="100%" size="1" style="color:darkblue">

</body>
</html>

Última edición por bomaye; 16/09/2003 a las 07:31