Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786

    [js] Errore verifica modulo

    Salve,

    ho una pagina Valid XHTML 1.0 Strict,

    in questa pagina è presente un modulo, con rispettivo controllo in js.

    il controllo non funziona

    perchè ?

    questo è il codice completo della pagina:

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Modulo</title>
    <script type="text/javascript">
      function Modulo(destinazione) {
    
         var Immobile = document.getElementById('annuncio').immobile;
    		
            if ((Immobile == "") || (Immobile == "undefined")) {
               alert("Il campo Immobile non è Valido.");
               document.getElementById('annuncio').immobile.focus();
               return false;
            }
    
            else {
               document.getElementById('annuncio').action = destinazione;
               document.getElementById('annuncio').submit();
            }
      }
    </script>
    </head>
    
    <body>
    	<form action="#" method="post" id="annuncio">
    		<fieldset>
    			<legend>Nuovo Immobile:</legend>
    				
    
    <label for="immobile">Immobile: </label>
    <input name="immobile" type="text" id="immobile" value="" size="20" /></p>
    				
    
    <input onclick="Modulo('modulo_edit_prodotto_2.asp')" type="submit" name="Submit" value="Invia" /></p>
    		</fieldset>
    		</form>
    </body>
    </html>
    grazie di cuore
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  2. #2
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    p.s. il controllo in js non ritorna nessuno errore,
    ma invia il modulo anche se il campo è vuoto
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  3. #3
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Prova cosi...

    if ((Immobile.value == "") || (Immobile == null)) {

  4. #4
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    Originariamente inviato da badaze
    Prova cosi...

    if ((Immobile.value == "") || (Immobile == null)) {
    il risultato non cambia
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  5. #5
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Originariamente inviato da unreg
    il risultato non cambia
    Comunque l'errore c'era....

  6. #6
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    usa un pulsante tipo "button" anziche "submit" visto che usi il metodo submit nella funzione....

  7. #7
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    non funziona lo stesso

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Modulo</title>
    <script type="text/javascript">
      function Modulo(destinazione) {
    
         var Immobile = document.getElementById('annuncio').immobile;
    		
            if ((Immobile == "") || (Immobile == "undefined")) {
               alert("Il campo Immobile non è Valido.");
               document.getElementById('annuncio').immobile.focus();
               return false;
            }
    
            else {
               document.getElementById('annuncio').action = destinazione;
               document.getElementById('annuncio').submit();
            }
      }
    </script>
    </head>
    
    <body>
    	<form action="#" method="post" id="annuncio">
    		<fieldset>
    			<legend>Nuovo Immobile:</legend>
    				
    
    <label for="immobile">Immobile: </label>
    <input name="immobile" type="text" id="immobile" value="" size="20" /></p>
    				
    
    <input onclick="Modulo('modulo_edit_prodotto_2.asp')" type="button" name="Submit" value="Invia" /></p>
    		</fieldset>
    		</form>
    </body>
    </html>
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  8. #8
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Certo che non funge se non metti tutte le correzioni. Con le due da me indicate funziona !!!


  9. #9
    Utente di HTML.it
    Registrato dal
    Dec 2002
    Messaggi
    1,786
    Originariamente inviato da badaze
    Certo che non funge se non metti tutte le correzioni. Con le due da me indicate funziona !!!

    fatto, ma non funziona lo stesso

    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Modulo</title>
    <script type="text/javascript">
      function Modulo(destinazione) {
    
         var Immobile = document.getElementById('annuncio').immobile;
    		
            if ((Immobile == "") || (Immobile == null)) {
               alert("Il campo Immobile non è Valido.");
               document.getElementById('annuncio').immobile.focus();
               return false;
            }
    
            else {
               document.getElementById('annuncio').action = destinazione;
               document.getElementById('annuncio').submit();
            }
      }
    </script>
    </head>
    
    <body>
    	<form action="#" method="post" id="annuncio">
    		<fieldset>
    			<legend>Nuovo Immobile:</legend>
    				
    
    <label for="immobile">Immobile: </label>
    <input name="immobile" type="text" id="immobile" value="" size="20" /></p>
    				
    
    <input onclick="Modulo('modulo_edit_prodotto_2.asp')" type="button" name="Tasto" value="Invia" /></p>
    		</fieldset>
    		</form>
    </body>
    </html>
    [Scambio Links a Tema] Contattatemi in Privato x + Info.

  10. #10
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    if ((Immobile.value == "")

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.