Foros del Web » Programando para Internet » Javascript »

Campos obligatorios javascript

Estas en el tema de Campos obligatorios javascript en el foro de Javascript en Foros del Web. como estan? les cuento, hice un formulario en javascript y php, esta todo terminado pero tengo un poblema con el campo obligatorio que no funciona... ...
  #1 (permalink)  
Antiguo 25/06/2011, 21:38
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Campos obligatorios javascript

como estan?
les cuento, hice un formulario en javascript y php, esta todo terminado pero tengo un poblema con el campo obligatorio que no funciona...

aqui le paso el codigo:
<?php
session_start();
include_once("../includes/procs.php");
include_once('../includes/tiemposession.php');
include_once('../includes/conexiones.php');
include_once("../includes/clases.php");
//************************************************** **************************************************
if (!es_usuario_habilitado($_SESSION['idusuario'])) {exit;}
//************************************************** **************************************************
conectarse();
$idusuario=limpia($_SESSION['idusuario']);
$saldo=saldo($idusuario);
$empresa=$_SESSION['empresa'];
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $empresa." - Inscripcion al concurso";?></title>
<link href="stylo0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="calendar.css">
<script language="JavaScript" src="calendar_eu.js"></script>
<style type="text/css">
.Estilo2 {font-size: 24px}
</style>
</head>
<body>
<?php
include("cabecera.php");
include("barrausuario.php");
?>
<table width="799" height="76" border="0" align="center" class="pagina" >
<tr>
<td width="793" height="48" align="center" valign="top" class="tdcentro">
<div class="barras1">
Inscripcion al concurso anual del mejor sitio web
</div>
<p>&nbsp;</p>
<table width="674" border="1">
<tr>
<td height="172"><div align="center">
<form action="envia_form_php.php" method="post">
Usuario:*
<input type="text" name="usuario" size="16" />
<br />
Sitio web participante:*
<input type="text" name="sitio" size="16" />
<br />
¿Tenes los derechos de la obra registrados?:*
<input type="text" name="derechosregistrados" size="16" />
<br />
Categoria del sitio:*
<input type="text" name="categoriaweb" size="16" />
<br />
Breve comentario:*
<textarea name="comentario" cols="32" rows="6"></textarea>
<br />
<input name="submit" type="submit" value="Enviar" />
</form>
<script type="text/javascript"> function checar()
{
with (document.form['form'])
{
if(usuario.value=="")
echo "Error, verifique";
{
{
with (document.form['form'])
{
if(sitio.value=="")
echo "Error, verifique";
{
{
with (document.form['form'])
{
if(derechosregistrados.value=="")
echo "Error, verifique";
{
{
with (document.form['form'])
{
if(categoriaweb.value=="")
echo "Error, verifique";
{
{
with (document.form['form'])
{
if(comentario.value=="")
echo "Error, verifique";
{
}</script>
<?
if ($_POST["nombre"]!=""){
//Estoy recibieno el formulario, compongo el cuerpo
$cuerpo = "Formulario enviado\n";
$cuerpo .= "Usuario: " . $HTTP_POST_VARS["usuario"] . "\n";
$cuerpo .= "Sitio web participante: " . $HTTP_POST_VARS["sitio"] . "\n";
$cuerpo .= "¿Tenes los derechos de la obra registrados?: " . $HTTP_POST_VARS["derechosregistrados"] . "\n";
$cuerpo .= "Categoria del sitio: " . $HTTP_POST_VARS["categoriaweb"] . "\n";
$cuerpo .= "Breve comentario: " . $HTTP_POST_VARS["comentario"] . "\n";

//mando el correo...
mail("[email protected]","Formulario recibido",$cuerpo);
}
?>
</div></td>
</tr>
</table>
<p>&nbsp;</p>
<tr align="center" valign="middle">
<th width="793" height="20" align="center" valign="middle" scope="row">
<?php
//include("barravacia.php");
include("pie.php");
?>
</td>
</tr>
</table>
</body>
</html>

Gracias a todos.
  #2 (permalink)  
Antiguo 26/06/2011, 05:43
Avatar de Alvaro_Franz  
Fecha de Ingreso: mayo-2011
Mensajes: 84
Antigüedad: 13 años
Puntos: 4
Respuesta: Campos obligatorios javascript

Para empezar debes indicar el problema, y reducir el código innecesario.

Un foro es para pedir ayuda, no favores.
  #3 (permalink)  
Antiguo 28/06/2011, 08:45
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Campos obligatorios javascript

Amigos he hecho un codigo en el cual los alerta funciona perfecto en una maquina y en la otraa no, es rarisimo porque no se que pasa.

El codigo es:
<?php
session_start();
include_once("../includes/procs.php");
include_once('../includes/tiemposession.php');
include_once('../includes/conexiones.php');
include_once("../includes/clases.php");
//************************************************** **************************************************
if (!es_usuario_habilitado($_SESSION['idusuario'])) {exit;}
//************************************************** **************************************************
$sitio=limpia($_POST['sitio']);
$derechosregistrados=limpia($_POST['derechosregistrados']);
$categoriaweb=limpia($_POST['categoriaweb']);
$comentario=limpia($_POST['comentario']);
//************************************************** **************************************************
conectarse();
$idusuario=limpia($_SESSION['idusuario']);
$saldo=saldo($idusuario);
$empresa=$_SESSION['empresa'];
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $empresa." - Inscripcion al concurso";?></title>
<link href="stylo0.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="calendar.css">
<script language="JavaScript" src="calendar_eu.js"></script>
<style type="text/css">
.Estilo5 {color: #990000}
.style1 {font-size: 18px}
</style>
</head>
<body>
<?php
include("cabecera.php");
include("barrausuario.php");
?>
<table width="831" height="76" border="0" align="center" class="pagina" >
<tr>
<td width="825" height="48" align="center" valign="top" class="tdcentro"><div class="barras1">Inscripcion al concurso</div>
<p>&nbsp;</p>
<table width="674" border="1">
<tr>
<td height="172"><div align="center">
<form action="concursoinscripcion.php" method="post">
Usuario:*
<span class="ingreso">
<input type="text" name="usuario" size="20" disabled="disabled" value="<?php print $usuario ?>" />
</span><br />
Sitio web participante:*
<input type="text" name="sitio" size="16" value="<?php print $sitio ?>"/>
<br />
¿Tenes los derechos de la obra registrados?:*
<input type="text" name="derechosregistrados" size="16" value="<?php print $derechosregistrados ?>"/>
<br />
Categoria del sitio:*
<input type="text" name="categoriaweb" size="16" value="<?php print $categoriaweb ?>"/>
<br />
Comentario:*
<textarea name="comentario" cols="30" rows="5"><?php print $comentario ?></textarea>
<br />
<input name="submit" type="submit" value="inscribirme" />
</form>
<?
if (isset($_POST['submit']))
{
$xerror='';
if (empty($_POST['sitio']) and $xerror=='') $xerror="La inscripcion actualmente se encuentra cerrada";
if (empty($_POST['derechosregistrados']) and $xerror=='') $xerror="La inscripcion actualmente se encuentra cerrada";
if (empty($_POST['categoriaweb']) and $xerror=='') $xerror="La inscripcion actualmente se encuentra cerrada";
if (empty($_POST['comentario']) and $xerror=='') $xerror="La inscripcion actualmente se encuentra cerrada";
if (empty($xerror))
{
//Estoy recibieno el formulario, compongo el cuerpo
$cuerpo = "Formulario enviado\n";
$cuerpo .= "Usuario: " . $HTTP_POST_VARS["<?php print $usuario ?>"] . "\n";
$cuerpo .= "Sitio web participante: " . $HTTP_POST_VARS["sitio"] . "\n";
$cuerpo .= "¿Tenes los derechos de la obra registrados?: " . $HTTP_POST_VARS["derechosregistrados"] . "\n";
$cuerpo .= "Categoria del sitio: " . $HTTP_POST_VARS["categoriaweb"] . "\n";
$cuerpo .= "Breve comentario: " . $HTTP_POST_VARS["comentario"] . "\n";
//mando el correo...
mail("[email protected]. ar","Inscripcion recibida",$cuerpo);
mensaje('La inscripcion actualmente se encuentra cerrada');
}
else
{
mensaje($xerror);
}
}
?>
</div></td>
</tr>
</table>
<p><span class="Estilo5">La inscripcion actualmente se encuentra cerrada </span></p>
<tr align="center" valign="middle">
<th width="825" height="20" align="center" valign="middle" scope="row">
<?php
//include("barravacia.php");
include("pie.php");
?>
</td>
</tr>
</table>
</body>
</html>

Mil gracias a todos.

Etiquetas: campos
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 11:03.