SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    408
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    [Javascript] Checkbox values

    [Javascript] Checkbox values

    Hello.

    I have a problem with this code ASP / Javascript.

    The problem is JavaScript; try this LINK and select value cespiti

    1) With ASP language is populated a secondary form, generated by a main form with a series of checkboxes, text fields and select;

    2) Selecting different checkbox from a secondary form and compiled other fields, this values must be copied to a single field hidden in the principal form;

    If the checkbox returned by the query SQL, is unique, the string:

    Code:
     return LG.substr();
    is right and compiled values in the field hidden in principal form.

    But if the checkbox returned by the query SQL are different, the string:

    Code:
     return LG.substr();
    response with:

    Code:
    undefined;undefined;undefined;undefined
    Can you help me?

    kind regards
    mike

  2. #2
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    408
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Any idea ?

  3. #3
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    408
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I have change the code.

    This is main form:

    Code:
    <html>
    <head>
    <script language="javascript" type="text/javascript">
    <!--
    
    // Variabile globale contenente l'istanza 'window' del popup corrente
    var popup = null;
     
    function Forum(fld, tbl, col, w, h)
    {
      var pw = Math.floor((screen.width - w) / 2);
      var ph = Math.floor((screen.height - h) / 2);
     
      // Crea il popup solo se non Ŕ giÓ stato aperto
      if (!popup || popup.closed) popup = window.open("popup.htm?f=" + fld + "&t=" + tbl + "&c=" + col, "scelte",
                                                      "width=" + w + ",height=" + h + ",top=" + ph + ",left=" + pw);
     
      // Attiva il popup (portalo in primo piano)
      if (popup) popup.focus();
    }
    
    //-->
    </script>
    
    </head>
    
    <body> 
    
    <form name=myform action="?upload=1" method="POST">
    
    <INPUT TYPE="hidden" NAME="dati_aggiuntivi" VALUE="xxxx">
    
    <select size="1" name="dettaglio_visita" style="font-size: 8 pt; font-family: Verdana" onchange="Forum(this.value, 'tbl_mac_visite_ispettive_dett', 'DETTAGLIO_VERIFICA', 700, 500); this.selectedIndex = 0;">">
    
    <option>Seleziona</option>
    <option value="14-Cespiti">Cespiti</option>
    </select> 
    
    </form>
    
    </body>
    </html>

    This is secondary form:

    Code:
      
      
    <html>
    <head>
    
    <title>Popup</title>
    <link rel=stylesheet href=/mac/css/applicativi.css>
    <link rel=stylesheet href=/mac/css/menu.css>
    
    <script language="javascript" type="text/javascript">
    <!--
    
    function insertf1(f1) {
       
            window.opener.document.myform.dati_aggiuntivi.value=f1;
            //alert("Dati aggiuntivi correttamente salvati.");
            //window.close();
            
            return f1.substr();
       
    }
    
    //-->
    </script>
    
    </head>
    
    <body>
     
    <form name="myform">
    
    
    
    <p>&nbsp;</p>
    
    <div align="center">
      <table border="0" id="table1">
        
    <tr>
       <td class=blub align="center">Sottodettaglio<br>Verifica</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">Eseguita?</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">Esito della verifica</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">Totale items<br>verificati</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">di cui<br>items KO</td>
    </tr>   
    
    
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
    </tr>   
    
    <tr>
       <td class=blub align="center">CS7</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_1" value="CS7"></td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    <select size="1" name="Esito">
       <option>Seleziona Esito</option>
       <option value="Sufficiente">Sufficiente</option>
       <option value="Insufficiente">Insufficiente</option>
       <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
       <option value="Dettagliato in verbale">Dettagliato in verbale</option>
    </select></td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center"><input type="text" name="ITEMS_1" size="5"></td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center"><input type="text" name="ITEMS_KO_1" size="5"></td>
    
    </tr>
          
    
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
    </tr>   
    
    <tr>
       <td class=blub align="center">CS20</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_2" value="CS20"></td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    <select size="1" name="Esito">
       <option>Seleziona Esito</option>
       <option value="Sufficiente">Sufficiente</option>
       <option value="Insufficiente">Insufficiente</option>
       <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
       <option value="Dettagliato in verbale">Dettagliato in verbale</option>
    </select></td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center"><input type="text" name="ITEMS_2" size="5"></td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center"><input type="text" name="ITEMS_KO_2" size="5"></td>
    
    </tr>
          
    
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
    </tr>   
    
    <tr>
       <td class=blub align="center">NCS24</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_3" value="NCS24"></td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    <select size="1" name="Esito">
       <option>Seleziona Esito</option>
       <option value="Sufficiente">Sufficiente</option>
       <option value="Insufficiente">Insufficiente</option>
       <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
       <option value="Dettagliato in verbale">Dettagliato in verbale</option>
    </select></td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center"><input type="text" name="ITEMS_3" size="5"></td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center"><input type="text" name="ITEMS_KO_3" size="5"></td>
    
    </tr>
          
    
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
    </tr>   
    
    <tr>
       <td class=blub align="center">NCS25</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_4" value="NCS25"></td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    <select size="1" name="Esito">
       <option>Seleziona Esito</option>
       <option value="Sufficiente">Sufficiente</option>
       <option value="Insufficiente">Insufficiente</option>
       <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
       <option value="Dettagliato in verbale">Dettagliato in verbale</option>
    </select></td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center"><input type="text" name="ITEMS_4" size="5"></td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center"><input type="text" name="ITEMS_KO_4" size="5"></td>
    
    </tr>
          
    
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
    </tr>   
    
    <tr>
       <td class=blub align="center">CS21</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_5" value="CS21"></td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    <select size="1" name="Esito">
       <option>Seleziona Esito</option>
       <option value="Sufficiente">Sufficiente</option>
       <option value="Insufficiente">Insufficiente</option>
       <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
       <option value="Dettagliato in verbale">Dettagliato in verbale</option>
    </select></td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center"><input type="text" name="ITEMS_5" size="5"></td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center"><input type="text" name="ITEMS_KO_5" size="5"></td>
    
    </tr>
          
    
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
    </tr>   
    
    <tr>
       <td class=blub align="center">CS29</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_6" value="CS29"></td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    <select size="1" name="Esito">
       <option>Seleziona Esito</option>
       <option value="Sufficiente">Sufficiente</option>
       <option value="Insufficiente">Insufficiente</option>
       <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
       <option value="Dettagliato in verbale">Dettagliato in verbale</option>
    </select></td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center"><input type="text" name="ITEMS_6" size="5"></td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center"><input type="text" name="ITEMS_KO_6" size="5"></td>
    
    </tr>
          
    
      
      </td>
        </tr>
    
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    &nbsp;</td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center">&nbsp;</td>
    
    </tr>
          
    <tr>
       <td class=blub align="center" colspan="9">
       <div align="center">
         <table border="0" id="table3">
           <tr>
             <td><p align="center">
                <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO_VERIFICA_6.value+';'+document.myform.Esito.value+';'+document.myform.ITEMS_6.value+';'+document.myform.ITEMS_KO_6.value)">
                <img border="0" src="salva_button.gif" width="84" height="16"></a></td>
             <td>&nbsp;</td>
             <td><p align="center"><a href="javascript:void(0);" onclick="window.close()">
                 <input type="image"src="chiudi_button.gif" border="0" align="middle" name="I5"></a></td>
           </tr>
         </table>
       </div>
       </td>
    
    </tr>
          
    <tr>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">&nbsp;</td>
       <td class=blub align="center">
    
    &nbsp;</td>
    <td class=blub align="center">&nbsp;</td>
    
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center">&nbsp;</td>
    <td class=blub align="center">&nbsp;</td>
    
    </tr>
          
      </table>
    </div>
    
    </form>
     
    </body>
    </html>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •