Visualizzazione dei risultati da 1 a 9 su 9

Discussione: checkbox non da alert

  1. #1

    checkbox non da alert

    vi prego, qualcuno sa dirmi dove sbaglio? il mio obiettivo è costringere alla selezione di una sola casella di testo o comunque che nessuna delle tre sia vuota... aiuto..


    Codice PHP:
    <SCRIPT>
    function 
    controllo_check() {
      var 
    ck1 document.aForm.testocheck1;
        var 
    ck2 document.aForm.testocheck2;
        var 
    ck3 document.aForm.testocheck3;

    ...

    if (
    ck1.checked==false && ck2.checked==false && ck3.checked==false) {
      
    alert('Errore: non hai espresso il tuo giudizio alla domanda 1');
      return 
    false;  
            }

    </SCRIPT> 
    Codice PHP:
    <form action="aggiornatesti.php?tipo=<? echo($tipo);?>&indice=<? echo($indice);?>&data=<? echo($data);?>oggetto=<? echo($oggetto);?>"  method="post" name="aForm" id="aForm" onsubmit="return controllo_check()">

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    613
    L'hai messa l'ultima parentesi graffa?
    Mi sa che te ne manca una per chiudere la funzione
    Conosci te stesso(?)
    (..e allora perchè scassi a me? )

  3. #3
    ok aggiunta, ma non funziona ......

  4. #4
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    613
    Non saprei, prova a postare tutta la funzione... i nomi delle checkbox sono quelli?

    Intendo testocheck1 ecc... sei sicuro?
    Conosci te stesso(?)
    (..e allora perchè scassi a me? )

  5. #5

  6. #6
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    613
    "si"... però posta il codice cmq
    Conosci te stesso(?)
    (..e allora perchè scassi a me? )

  7. #7
    Codice PHP:
    <form action="aggiornatesti.php?tipo=<? echo($tipo);?>&indice=<? echo($indice);?>&data=<? echo($data);?>oggetto=<? echo($oggetto);?>"  method="post" name="aForm" id="aForm" ="return controllo_check()">
    <input type="hidden" value="" name="testocheck1">
    <input type="hidden" value="" name="testocheck2">
    <input type="hidden" value="" name="testocheck3">

    <table width=631 border=0 align="center" cellpadding=0 cellspacing=0 bgcolor="#6BA49E">
      <tr >
        <td colspan="3">[url="index.php"][img]immagini/stampasarda_r1_c1.jpg[/img][/url]    </td>
      </tr>
      <tr align="left" valign="top">
        <td width="5" height="603" rowspan="29">
        
        
        <table width="100%"  border="0" cellspacing="1" cellpadding="1">
            <tr>          </tr>
            </table>
            
            <table width="100%"  border="0" cellspacing="1" cellpadding="1">

            <tr>        </tr></table>
            <table width="99%"  border="0" cellspacing="1" cellpadding="1">
            <tr>        </tr></table>
            <table width="100%"  border="0" cellspacing="1" cellpadding="1">

          <tr>      </tr></table>    </td>
        <td width="621" rowspan="29">    <div align="center">
          <table width="100%" height="250"  border="0" cellpadding="1" cellspacing="1">
            <tr>
              <td height="15" colspan="2" valign="bottom"><div align="left">[b]Inserire data [/b]</div></td>
              <td width="1%" rowspan="4" valign="bottom">[url="prova1.php?tipo=pro&elenco=morosi&indice=indice&oggetto=oggetto&testocheck1=testocheck1&testocheck2=testocheck2&testocheck2=testocheck2&testo=testo&testo2=testo2&testo3=testo3"][/url] </td>
            </tr>
            <tr>
              <td width="47%" height="15" valign="bottom"><div align="left">
    <input name="data" type="text" id="data" size="20" maxlength="10" value=" ">
              </div></td>
                <td width="52%" valign="bottom"><div align="right">
                  <button name="submit" type="submit" value="1">
                          [b]Anteprima [/b]</button>
                </div></td>
            </tr>

            <tr>
              <td height="15" valign="bottom"><div align="left">[b]
                Inserire oggetto
                
              [/b]</div></td>
                <td height="15" valign="bottom"></td>
            </tr>
            <tr>
              <td height="15" valign="bottom"><div align="left">
                <textarea name="oggetto" rows="2" id="oggetto"></textarea>
              </div></td>
                <td height="15" valign="bottom"><div align="right">::[url="javascript:history.back();"]Torna indietro[/url] ::</div></td>
            </tr>
            <tr>
              <td height="15" colspan="3" valign="bottom"><div align="center">[b]Testo 1 [/b]</div></td>
                </tr>
            <tr bgcolor="#CDE5E5">
              <td height="137" colspan="3" >
      <textarea name="testo" rows="8" cols="100" wrap="soft" onSelect="storeCaret(this);" onClick="storeCaret(this);" onKeyUp="storeCaret(this);" onDblClick="storeCaret(this);"><? echo "$row[testo]";?>
    </textarea>
      



    <INPUT TYPE="button" VALUE="Grassetto" onCLICK="insertAtCaret(this.form.testo, '[B]','[/B]');">
    <INPUT TYPE="button" VALUE="Corsivo" onCLICK="insertAtCaret(this.form.testo, '[I]','[/I]');">
    <INPUT TYPE="button" VALUE="Sottolineato" onCLICK="insertAtCaret(this.form.testo, '<U>','</U>');">
    <INPUT TYPE="button" VALUE="a Capo" onCLICK="insertAtCaret1(this.form.testo, '
    ');">
    <input type="checkbox" name="testocheck1" value="1">
                Seleziona testo 1 </td>
            </tr>
          <tr>
              <td height="15" colspan="3" valign="bottom"><div align="center">[b]Testo 2 [/b]</div></td>
                </tr>
            <tr bgcolor="#CDE5E5">
              <td height="137" colspan="3" ><textarea name="testo2" rows="8" cols="100" wrap="soft" onSelect="storeCaret(this);" onClick="storeCaret(this);" onKeyUp="storeCaret(this);" onDblClick="storeCaret(this);"><? echo "$row2[testo]";?>
    </textarea>



    <INPUT TYPE="button" VALUE="Grassetto" onCLICK="insertAtCaret(this.form.testo2, '[B]','[/B]');">
    <INPUT TYPE="button" VALUE="Corsivo" onCLICK="insertAtCaret(this.form.testo2, '[I]','[/I]');">
    <INPUT TYPE="button" VALUE="Sottolineato" onCLICK="insertAtCaret(this.form.testo2, '<U>','</U>');">
    <INPUT TYPE="button" VALUE="a Capo" onCLICK="insertAtCaret1(this.form.testo2, '
    ');">
    <input type="checkbox" name="testocheck2" value="1" >
                Seleziona testo 2 </td>
              </tr>
          <tr>
              <td height="15" colspan="3" valign="bottom"><div align="center">[b]Testo 3 [/b]</div></td>
                </tr>
            <tr bgcolor="#CDE5E5">
              <td height="137" colspan="3" ><textarea name="testo3" rows="8" cols="100" wrap="soft" onSelect="storeCaret(this);" onClick="storeCaret(this);" onKeyUp="storeCaret(this);" onDblClick="storeCaret(this);"><? echo "$row3[testo]";?>
    </textarea>



    <INPUT TYPE="button" VALUE="Grassetto" onCLICK="insertAtCaret(this.form.testo3, '[B]','[/B]');">
    <INPUT TYPE="button" VALUE="Corsivo" onCLICK="insertAtCaret(this.form.testo3, '[I]','[/I]');">
    <INPUT TYPE="button" VALUE="Sottolineato" onCLICK="insertAtCaret(this.form.testo3, '<U>','</U>');">
    <INPUT TYPE="button" VALUE="a Capo" onCLICK="insertAtCaret1(this.form.testo3, '
    ');">
    <input type="checkbox" name="testocheck3" value="1">
                Seleziona testo 3 </td>
              </tr>
          </table>
          

      </div></td>
        <td width="5">

    </p>
        
        
     </td>
      </tr> 
    </table>




    </p>
    </form>

  8. #8
    Hai messo due campi di type diverso con nome testocheck1
    Hai messo due campi di type diverso con nome testocheck2
    Hai messo due campi di type diverso con nome testocheck3
    codice:
    <input type="hidden" value="" name="testocheck1">
    <input type="hidden" value="" name="testocheck2">
    <input type="hidden" value="" name="testocheck3">
    
    ....
    <INPUT TYPE="button" VALUE="a Capo" onCLICK="insertAtCaret1(this.form.testo, '
    ');">
    <input type="checkbox" name="testocheck1" value="1">
                Seleziona testo 1 </td>
    ....
    <INPUT TYPE="button" VALUE="a Capo" onCLICK="insertAtCaret1(this.form.testo2, '
    ');">
    <input type="checkbox" name="testocheck2" value="1" >
                Seleziona testo 2 </td>
    ....
    <INPUT TYPE="button" VALUE="a Capo" onCLICK="insertAtCaret1(this.form.testo3, '
    ');">
    <input type="checkbox" name="testocheck3" value="1">
                Seleziona testo 3 </td>
    ....
    HTH
    Zappa
    [PC:Presario 2515EU][Cpu:P4@2.3GHz][Ram: 512M][HDU:80G@5400 RPM]
    [Wireless:LinkSys][OS: Ubuntu 9.04 - Jaunty Jackalope]

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    613
    Ha ragione zappa
    Conosci te stesso(?)
    (..e allora perchè scassi a me? )

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.