News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Java alert in form

Started by [darksteel], July 07, 2005, 03:45:37 PM

Previous topic - Next topic

[darksteel]

 ;) Hi again whit my problems !!!!!!! :-X

:P In this code i put the java to show alert when user is blank or character invalid.
$form[registro] = '
          <form name="form"  action="?envio" onsubmit="return revisar_usuario() method="post">
          <table width="100%">
          <tr><td width="25%" align="right" valign="top">
             <b>Nombre:</b>
          <td width="75%">
             <input type="text" size="25" name="nombre" id="nick" malength="100"> <font color=red>*</font>
          <tr><td width="25%" align="right" valign="top">
             <b>E-mail:</b>
          <td width="75%">
             <input type="text" size="25" name="email" malength="100"> <font color=red>*</font>
<tr><td width="25%" align="right" valign="top">
             <b>Contraseña:</b>
          <td width="75%">
             <input type="password" size="25" name="contrasena" malength="100"> <font color=red>*</font>
          <tr><td width="25%" align="right" valign="top">
             <b>País:</b>
          <td width="75%">
            <input type="text" size="25" name="pais" malength="100">
          </table><br>

         <center><input type="submit" value="&nbsp;&nbsp;&nbsp;&nbsp;Enviar&nbsp;&nbsp;&nbsp;&nbsp;">
          <input type="reset" value="&nbsp;&nbsp;&nbsp;&nbsp;Borrar&nbsp;&nbsp;&nbsp;&nbsp;"></center>
          </form>¿ Perdiste tu Password ?<br>
';


The java:
function revisar_usuario() {
document.form.nombre.value = document.form.nombre.value.replace(/^\s*|\s*$/g,'') ;
document.form.contrasena.value = document.form.contrasena.value.replace(/^\s*|\s*$/g,'') ;
if(document.form.nombre.value.length == 0) {
alert('Debes escribir un nick') ;
return false ;
}
if(document.form.contrasena.value.length == 0) {
alert('Debes escribir una contraseña') ;
return false ;
}
}


Now, when I not write de username the form retur, don't show alert....

http://cmh-ip.net/usuarios.php?registrarme

Thanks again..



Luis "[darksteel]" Alvarado.
Spanish Support
¿Qué es el repair_settings?
No doy soporte por PM, publica tu duda en el foro y tendras respuestas mas rapidas.
My forum:
www.caamboard.com

Tomer

Change
onsubmit="return revisar_usuario()

to
onsubmit="return revisar_usuario()"

[darksteel]




Luis "[darksteel]" Alvarado.
Spanish Support
¿Qué es el repair_settings?
No doy soporte por PM, publica tu duda en el foro y tendras respuestas mas rapidas.
My forum:
www.caamboard.com

[darksteel]

 ;D Hi again !.

When I create cookie, but show error.

Ingresado como das....
Warning: Cannot modify header information - headers already sent by (output started at /home/rulz/public_html/conf.php:31) in /home/rulz/public_html/usuarios.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /home/rulz/public_html/conf.php:31) in /home/rulz/public_html/usuarios.php on line 39


The code to make:
Quote   36if($contrasena == $row[contrasena]){     
   37echo" Ingresado como $nombre....";
   38 setcookie('cmhipnombre',$nombre,time()+1296000);
   39 setcookie('cmhipcontrasena',$contrasena,time()+1296000);
}

In conf.php at line 31:
Quotefunction cabecera($seccion){
    echo '
   <html><head>
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
            <META NAME="Title" CONTENT="CMH-IP">
            <META NAME="Description" CONTENT="CMH-IP - Desarollo Web - webmaster - webdesigners - disenadores - programadores - desarrolladores - foros, sistema de comentarios, noticias,foros,galerias etc.">
            <META NAME="Language" CONTENT="Espanol">
            <META NAME="Copyright" CONTENT="CMH-IP">
            <META NAME="Distribution" CONTENT="Global">
          <script language="JavaScript" type="text/javascript" src="u_java.js"></script>
            <title>CMH-IP [desarrollo web] - ['.$seccion.']</title>
            <head>
            <link rel="stylesheet" content="text/css" href="cmhip.css">
            <script>
            <!-- Detener Error -->
            function detenerError(){
            return true
            }
            window.onerror=detenerError
            </script>';
  }



Luis "[darksteel]" Alvarado.
Spanish Support
¿Qué es el repair_settings?
No doy soporte por PM, publica tu duda en el foro y tendras respuestas mas rapidas.
My forum:
www.caamboard.com

morph

at the beginning of the script put


<?php

ob_start
();

?>


and at the end put


<?php 

ob_end_flush
();

?>

Coming soon!

[darksteel]




Luis "[darksteel]" Alvarado.
Spanish Support
¿Qué es el repair_settings?
No doy soporte por PM, publica tu duda en el foro y tendras respuestas mas rapidas.
My forum:
www.caamboard.com

morph

No problem, had the same problem a while ago but after some research found that on php.net

Coming soon!

Advertisement: