Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    Script controllo dati personali si blocca alla voce "COGNOME"

    Salve a tutti.
    Ho cercato questo script sul web e poi modificato a seconda delle mie esigenze. Ma nella fase di test ho visto che fa solo i primi 2 controlli, cioè solo il "NOME" & "COGNOME"

    codice:
    <script language="JavaScript"> 
    function controllo(){ 
    with(document.modulo) { 
    if(nome.value=="") { 
    alert("Errore: compilare il campo NOME"); 
    nome.focus(); 
    return false; 
    }
    if(cognome.value=="") { 
    alert("Errore: compilare il campo COGNOME"); 
    cognome.focus(); 
    return false; 
    }
    if(telefono.value=="") { 
    alert("Errore: compilare il campo TELEFONO"); 
    telefono.focus(); 
    return false; 
    }
    if(sito.value=="") { 
    alert("Errore: compilare il campo SITO"); 
    sito.focus(); 
    return false; 
    }
    } 
    alert("Controllo effettuato con successo. Il modulo sarà inviato."); 
    return true; 
    } 
    </script>
    Non credo di aver sbagliato qualcosa nel form, quindi magari è sbagliato lo script?
    Grazie mille

  2. #2
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    Non sembra vediamo il resto della pagina (solo codice html non codice server tipo php o asp)
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  3. #3
    Ecco:



    codice:
    		<form name="modulo" id="form_446072" class="appnitro" onSubmit="return controllo();" method="post" action="<?=$_SERVER['PHP_SELF'] ?>">
    					<div class="form_description" align"center">
    			
    <h2>INSERISCI I DATI E INVIA LA RICHIESTA</h2>
    			
    
    Se siete una coppia inserire i dati solo di una persona. verrete comunque ricontattati. 
    I campi delimitati da un "*" sono obbligatori.</p>
    		</div>						
    			<ul >
    			
    					<li id="li_1" >
    		<label class="description" for="element_1">NOME* </label>
    		<span>
    			<input id="nome" name= "nome" class="element text" maxlength="255" size="8" value=""/>
    			<label>Nome</label>
    		</span>
    		<span>
    			<input id="cognome" name= "cognome" class="element text" maxlength="255" size="14" value=""/>
    			<label>Cognome</label>
    		</span> 
    		
    		<li id="li_2" >
    		<label class="description" for="element_2">NATA/O A </label>
    		<div>
    			<input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/> 
    		</div> 
    				<li id="li_3" >
    		<label class="description" for="element_3">IL </label>
    		<span>
    			<input id="element_3_2" name="element_3_2" class="element text" size="2" maxlength="2" value="" type="text"> /
    			<label for="element_3_2">GG</label>
    		</span>
    		<span>
    			<input id="element_3_1" name="element_3_1" class="element text" size="2" maxlength="2" value="" type="text"> /
    			<label for="element_3_1">M</label>
    		</span>
    		<span>
    	 		<input id="element_3_3" name="element_3_3" class="element text" size="4" maxlength="4" value="" type="text">
    			<label for="element_3_3">ANNO</label>
    		</span>
    	
    		<span id="calendar_3">
    				
    		</span>
    		<script type="text/javascript">
    			Calendar.setup({
    			inputField	 : "element_3_3",
    			baseField    : "element_3",
    			displayArea  : "calendar_3",
    			button		 : "cal_img_3",
    			ifFormat	 : "%e %B, %Y",
    			onSelect	 : selectDate
    			});
    		</script>
    		 
    		
    		<li id="li_4" >
    		<label class="description" for="element_4">INDIRIZZO </label>
    		
    		<div>
    			<input id="element_4_1" name="element_4_1" class="element text large" value="" type="text">
    			<label for="element_4_1">Via, Piazza, etc..</label>
    		</div>
    	
    		<div>
    			<input id="element_4_2" name="element_4_2" class="element text large" value="" type="text">
    			<label for="element_4_2">Via, Piazza, etc..</label>
    		</div>
    	
    		<div class="left">
    			<input id="element_4_3" name="element_4_3" class="element text medium" value="" type="text">
    			<label for="element_4_3">Città</label>
    		</div>
    	
    		<div class="right">
    			<input id="element_4_4" name="element_4_4" class="element text medium" value="" type="text">
    			<label for="element_4_4">Provincia</label>
    		</div>
    	
    		<div class="left">
    			<input id="element_4_5" name="element_4_5" class="element text medium" maxlength="15" value="" type="text">
    			<label for="element_4_5">CAP</label>
    		</div>
    	
    		<div class="right">
    			<select class="element select medium" id="element_4_6" name="element_4_6"> 
    			<option value="" selected="selected"></option>
    <option value="Vanuatu" >Vanuatu</option>
    <option value="Vatican City" >Vatican City</option>
    <option value="Venezuela" >Venezuela</option>
    <option value="Vietnam" >Vietnam</option>
    <option value="Yemen" >Yemen</option>
    <option value="Zambia" >Zambia</option>
    <option value="Zimbabwe" >Zimbabwe</option>
    	
    			</select>
    		<label for="element_4_6">Paese</label>
    	</div> 
    		
    		<li id="li_5" >
    		
    		<label class="description" for="element_5">TELEFONO* </label>
    		<span>
    			<input id="telefono" name="telefono" class="element text" size="3" maxlength="3" value="" type="text"> -
    			<label for="element_5_1">123</label>
    		</span>
    		<span>
    			<input id="telefono" name="telefono" class="element text" size="3" maxlength="3" value="" type="text"> -
    			<label for="element_5_2">123</label>
    		</span>
    			<span>
    	 		<input id="telefono" name="telefono" class="element text" size="4" maxlength="4" value="" type="text">
    			<label for="element_5_3">1234</label>
    		</span>
    		 
    		
    		<li id="li_6" >
    		<label class="description" for="element_6">Email </label>
    		<div>
    			<input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value=""/> 
    		</div> 
    				<li id="li_9" >
    
    		<label class="description" for="element_9">COME CLASSIFICHERESTI IL TUO BALLO ATTUALE?* </label>
    		<div>
    		<select class="element select medium" id="element_9" name="element_9"> 
    <option value="1" >Pricipiante</option>
    <option value="2" >Intermedio</option>
    <option value="3" >Avanzato</option>
    
    		</select>
    		</div> 
    				<li id="li_8" >
    
    		<label class="description" for="element_8">CONTRASSEGNA I BALLI CHE VORRESTI IMPARARE </label>
    		<span>
    			<input id="element_8_1" name="element_8" class="element radio" type="radio" value="1" />
    <label class="choice" for="element_8_1">V. Lento</label>
    <input id="element_8_2" name="element_8_1" class="element radio" type="radio" value="2" />
    <label class="choice" for="element_8_2">Tango</label>
    <input id="element_8_3" name="element_8_2" class="element radio" type="radio" value="3" />
    <label class="choice" for="element_8_3">Foxtrot</label>
    <input id="element_8_4" name="element_8_3" class="element radio" type="radio" value="4" />
    <label class="choice" for="element_8_4">V. Viennese</label>
    <input id="element_8_5" name="element_8_4" class="element radio" type="radio" value="5" />
    <label class="choice" for="element_8_5">Paso Doble</label>
    <input id="element_8_6" name="element_8_5" class="element radio" type="radio" value="6" />
    <label class="choice" for="element_8_6">Rumba</label>
    <input id="element_8_7" name="element_8_6" class="element radio" type="radio" value="7" />
    <label class="choice" for="element_8_7">Cha Cha</label>
    <input id="element_8_8" name="element_8_7" class="element radio" type="radio" value="8" />
    <label class="choice" for="element_8_8">Swing</label>
    <input id="element_8_9" name="element_8_8" class="element radio" type="radio" value="9" />
    <label class="choice" for="element_8_9">Samba</label>
    <input id="element_8_10" name="element_8_9" class="element radio" type="radio" value="10" />
    <label class="choice" for="element_8_10">Salsa</label>
    <input id="element_8_11" name="element_8_10" class="element radio" type="radio" value="11" />
    <label class="choice" for="element_8_11">Bachata</label>
    <input id="element_8_12" name="element_8_11" class="element radio" type="radio" value="12" />
    <label class="choice" for="element_8_12">Mambo</label>
    <input id="element_8_13" name="element_8_12" class="element radio" type="radio" value="13" />
    <label class="choice" for="element_8_13">Merengue</label>
    <input id="element_8_14" name="element_8_13" class="element radio" type="radio" value="14" />
    <label class="choice" for="element_8_14">Mazurka</label>
    <input id="element_8_15" name="element_8_14" class="element radio" type="radio" value="15" />
    <label class="choice" for="element_8_15">Polka</label>
    <input id="element_8_16" name="element_8_15" class="element radio" type="radio" value="16" />
    <label class="choice" for="element_8_16">Country</label>
    <input id="element_8_17" name="element_8_16" class="element radio" type="radio" value="17" />
    <label class="choice" for="element_8_17">C/W Swing</label>
    <input id="element_8_18" name="element_8_17" class="element radio" type="radio" value="18" />
    <label class="choice" for="element_8_18">Tango Argentino</label>
    <input id="element_8_19" name="element_8_18" class="element radio" type="radio" value="19" />
    <label class="choice" for="element_8_19">Milonga</label>
    <input id="element_8_20" name="element_8_19" class="element radio" type="radio" value="20" />
    <label class="choice" for="element_8_20">Tango Vals</label>
    <input id="element_8_21" name="element_8_20" class="element radio" type="radio" value="21" />
    <label class="choice" for="element_8_21">Bolero</label>
    
    		</span> 
    				<li id="li_7" >
    		<label class="description" for="element_7">Altro </label>
    		<div>
    			<input id="element_7" name="element_7" class="element text medium" type="text" maxlength="255" value=""/> 
    		</div> 
    				<li id="li_10" >
    
    		<label class="description" for="element_10">COME HAI CONOSCIUTO IL SITO?* </label>
    		<span>
    			<input id="sito" name="sito" class="element radio" type="radio" value="1" />
    <label class="choice" for="element_10_1">Internet</label>
    <input id="element_10_2" name="element_10" class="element radio" type="radio" value="2" />
    <label class="choice" for="element_10_2">Volantini</label>
    <input id="element_10_3" name="element_10" class="element radio" type="radio" value="3" />
    <label class="choice" for="element_10_3">Giornali</label>
    <input id="element_10_4" name="element_10" class="element radio" type="radio" value="4" />
    <label class="choice" for="element_10_4">Amici</label>
    <input id="element_10_5" name="element_10" class="element radio" type="radio" value="5" />
    <label class="choice" for="element_10_5">Altro</label>
    
    		</span> 
    				<li id="li_9" >
    
    		<label class="description" for="element_9">IN QUALE SCUOLA DESIDERI BALLARE?* </label>
    		<div>
    		<select class="element select medium" id="element_9" name="element_9"> 
    		
    <?php
    	$c=mysql_connect ("62.149.150.141", "Sql489362" , "2af6142e");
    	mysql_query ("use Sql489362_5", $c);
    	$sql="select * from newsletter_categories where id >1 order by name";
    	$dati=mysql_query($sql);
    
    	while($riga=mysql_fetch_array($dati))
    	{
    		echo "<option value=" .  $riga['id'] .">" . $riga['name'] ."</option>";
    	}
    ?>
    
    
    		</select>
    		</div> 
    		
    
    		
    <div class="form_description"></div>
    			
    
    QUESTA PICCOLA INTERVISTA CI AIUTERA' A PERSONALIZZARE IL TUO BALLO. TI PREGHIAMO DI RISPONDERE ALLE DOMANDE SOTTOSTANTI O LASCIARE VUOTO LO SPAZIO.</p>
    						
    			<ul >
    			
    					<li id="li_1" >
    		<label class="description" for="element_1">DA QUANTO TEMPO VOLEVI IMPARARE A BALLARE? </label>
    		<div>
    			<textarea id="element_1" name="element_1" class="element textarea medium"></textarea> 
    		</div> 
    		
    		<li id="li_2" >
    		<label class="description" for="element_2">COME MAI HAI DECISO PROPRIO ADESSO DI INIZIARE A BALLARE? </label>
    		<div>
    			<textarea id="element_2" name="element_2" class="element textarea medium"></textarea> 
    		</div> 
    		
    		<li id="li_3" >
    		<label class="description" for="element_3">QUALCUNO SA CHE STAI PER BALLARE? COSA NE PENSANO? </label>
    		<div>
    			<textarea id="element_3" name="element_3" class="element textarea medium"></textarea> 
    		</div> 
    		
    		<li id="li_4" >
    		<label class="description" for="element_4">QUANTE VOLTE A SETTIMANA VORRESTI DEDICARE AL TUO BALLO? </label>
    		<div>
    			<textarea id="element_4" name="element_4" class="element textarea medium"></textarea> 
    		</div> 
    		
    		<li id="li_5" >
    		<label class="description" for="element_5">COSA TI ASPETTI DA QUESTA ESPERIENZA? </label>
    		<div>
    			<textarea id="element_5" name="element_5" class="element textarea medium"></textarea> 
    		</div> 
    		
    		<li id="li_6" >
    		<label class="description" for="element_6">SEI IN COPPIA O LO FAI PER TE STESSO/A? </label>
    		<div>
    			<textarea id="element_6" name="element_6" class="element textarea medium"></textarea> 
    		</div> 
    		
    		
    			
    					<li class="buttons">
    			    <input type="hidden" name="form_id" value="446072" />
    			    
    				<input id="saveForm" class="button_text" type="submit" VALUE="invia" />
    		
    			[/list]
    		</form>	
    	</div>
    </html>

  4. #4
    E' un po lunghetto

  5. #5
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    Hai 3 elementi input con nome e id "telefono"
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  6. #6
    quindi?
    è quello che da noia?

  7. #7
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    Originariamente inviato da amivan85
    quindi?
    Due vanno tolti
    è quello che da noia?
    Ovvio altrimenti non l'avrei segnalto
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

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.