Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Onsubmit

  1. #1

    Onsubmit

    so ke scritto così nn va bene, anke perkè nn funziona
    codice:
    <form method='post' name='formcheck' action='verifica_registrazione.php' onSubmit="return defaultagree(this)" onsubmit="return formCheck(this);">
    quindi come unisco i due onsubmit?
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  2. #2
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    onsubmit="return (funzione1() && funzione2())"

    entrambe le funzioni devono espressamente ritornare true se il controllo va a buon fine
    chiaramente false se il controllo fallisce, ma questo sicuramente ci sara' gia'
    ciao

  3. #3
    ok..aggiustato questo, il problema sussiste per una funzione ke non va e cioè la formCheck(this),
    ke in pratica mi obbliga a rimepire tutti i campi del form per poter procedere.

    codice:
    <script language="JavaScript">
    <!--
    function formCheck(formobj){
    	// Enter name of mandatory fields
    	var fieldRequired = Array("Nome_band", "Email", "Email2");
    	// Enter field description to appear in the dialog box
    	var fieldDescription = Array("Nome_band", "Email", "Email2");
    	// dialog message
    	var alertMsg = "Riempire tutti i campi:\n";
    	
    	var l_Msg = alertMsg.length;
    	
    	for (var i = 0; i < fieldRequired.length; i++){
    		var obj = formobj.elements[fieldRequired[i]];
    		if (obj){
    			switch(obj.type){
    			case "select-one":
    				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
    					alertMsg += " - " + fieldDescription[i] + "\n";
    				}
    				break;
    			case "select-multiple":
    				if (obj.selectedIndex == -1){
    					alertMsg += " - " + fieldDescription[i] + "\n";
    				}
    				break;
    			case "text":
    			case "textarea":
    				if (obj.value == "" || obj.value == null){
    					alertMsg += " - " + fieldDescription[i] + "\n";
    				}
    				break;
    			default:
    			}
    			if (obj.type == undefined){
    				var blnchecked = false;
    				for (var j = 0; j < obj.length; j++){
    					if (obj[j].checked){
    						blnchecked = true;
    					}
    				}
    				if (!blnchecked){
    					alertMsg += " - " + fieldDescription[i] + "\n";
    				}
    			}
    		}
    	}
    
    	if (alertMsg.length == l_Msg){
    		return true;
    	}else{
    		alert(alertMsg);
    		return false;
    	}
    }
    // -->
    </script>
    questo è il corpo dello script, poi c'è appunto il return nel tag form e i campi text con name Nome_band, Email, Email2.

    cosa c'è ke non va?
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  4. #4
    up
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

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.