By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,321 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,321 IT Pros & Developers. It's quick & easy.

[Javascript] Checkbox values

P: 66
[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:

Expand|Select|Wrap|Line Numbers
  1.  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:

Expand|Select|Wrap|Line Numbers
  1.  return LG.substr(); 
response with:

Expand|Select|Wrap|Line Numbers
  1. undefined;undefined;undefined;undefined  
Can you help me?

kind regards
mike
Sep 3 '08 #1
Share this Question
Share on Google+
22 Replies


acoder
Expert Mod 15k+
P: 16,027
Can you explain what you mean by "checkbox returned by the query SQL is unique/different"?
Sep 3 '08 #2

P: 66
Can you explain what you mean by "checkbox returned by the query SQL is unique/different"?
checkbox unique in the secondary form:

Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="DETTAGLIO_1" value="CS7">

checkbox different in the secondary form:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type="checkbox" name="DETTAGLIO_1" value="CS7">
  3.  
  4. <input type="checkbox" name="DETTAGLIO_2" value="CS20">
  5.  
  6. <input type="checkbox" name="DETTAGLIO_3" value="NCS24">
  7.  
  8.  
Sep 3 '08 #3

acoder
Expert Mod 15k+
P: 16,027
How do you generate the LG string?
Sep 3 '08 #4

P: 66
How do you generate the LG string?
Open this link:
http://users1.titanichost.com/MiguelRivero61/

Select "cespiti" value in the main form;

In the popup page I have secondary form;

Select checkbox and the other fields and click in the button "salva".

Generate LG string
Sep 4 '08 #5

P: 66
I have change the code.

This is main form:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3. <head>
  4. <script language="javascript" type="text/javascript">
  5. <!--
  6.  
  7. // Variabile globale contenente l'istanza 'window' del popup corrente
  8. var popup = null;
  9.  
  10. function Forum(fld, tbl, col, w, h)
  11. {
  12.   var pw = Math.floor((screen.width - w) / 2);
  13.   var ph = Math.floor((screen.height - h) / 2);
  14.  
  15.   // Crea il popup solo se non č gią stato aperto
  16.   if (!popup || popup.closed) popup = window.open("popup.htm?f=" + fld + "&t=" + tbl + "&c=" + col, "scelte",
  17.                                                   "width=" + w + ",height=" + h + ",top=" + ph + ",left=" + pw);
  18.  
  19.   // Attiva il popup (portalo in primo piano)
  20.   if (popup) popup.focus();
  21. }
  22.  
  23. //-->
  24. </script>
  25.  
  26. </head>
  27.  
  28. <body> 
  29.  
  30. <form name=myform action="?upload=1" method="POST">
  31.  
  32. <INPUT TYPE="hidden" NAME="dati_aggiuntivi" VALUE="xxxx">
  33.  
  34. <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;">">
  35.  
  36. <option>Seleziona</option>
  37. <option value="14-Cespiti">Cespiti</option>
  38. </select> 
  39.  
  40. </form>
  41.  
  42. </body>
  43. </html>
  44.  
  45.  

This is secondary form:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  
  4. <html>
  5. <head>
  6.  
  7. <title>Popup</title>
  8. <link rel=stylesheet href=/mac/css/applicativi.css>
  9. <link rel=stylesheet href=/mac/css/menu.css>
  10.  
  11. <script language="javascript" type="text/javascript">
  12. <!--
  13.  
  14. function insertf1(f1) {
  15.  
  16.         window.opener.document.myform.dati_aggiuntivi.value=f1;
  17.         //alert("Dati aggiuntivi correttamente salvati.");
  18.         //window.close();
  19.  
  20.         return f1.substr();
  21.  
  22. }
  23.  
  24. //-->
  25. </script>
  26.  
  27. </head>
  28.  
  29. <body>
  30.  
  31. <form name="myform">
  32.  
  33.  
  34.  
  35. <p>&nbsp;</p>
  36.  
  37. <div align="center">
  38.   <table border="0" id="table1">
  39.  
  40. <tr>
  41.    <td class=blub align="center">Sottodettaglio<br>Verifica</td>
  42.    <td class=blub align="center">&nbsp;</td>
  43.    <td class=blub align="center">Eseguita?</td>
  44.    <td class=blub align="center">&nbsp;</td>
  45.    <td class=blub align="center">Esito della verifica</td>
  46.    <td class=blub align="center">&nbsp;</td>
  47.    <td class=blub align="center">Totale items<br>verificati</td>
  48.    <td class=blub align="center">&nbsp;</td>
  49.    <td class=blub align="center">di cui<br>items KO</td>
  50. </tr>   
  51.  
  52.  
  53.  
  54. <tr>
  55.    <td class=blub align="center">&nbsp;</td>
  56.    <td class=blub align="center">&nbsp;</td>
  57.    <td class=blub align="center">&nbsp;</td>
  58.    <td class=blub align="center">&nbsp;</td>
  59.    <td class=blub align="center">&nbsp;</td>
  60.    <td class=blub align="center">&nbsp;</td>
  61.    <td class=blub align="center">&nbsp;</td>
  62.    <td class=blub align="center">&nbsp;</td>
  63. </tr>   
  64.  
  65. <tr>
  66.    <td class=blub align="center">CS7</td>
  67.    <td class=blub align="center">&nbsp;</td>
  68.    <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_1" value="CS7"></td>
  69.    <td class=blub align="center">&nbsp;</td>
  70.    <td class=blub align="center">
  71.  
  72. <select size="1" name="Esito">
  73.    <option>Seleziona Esito</option>
  74.    <option value="Sufficiente">Sufficiente</option>
  75.    <option value="Insufficiente">Insufficiente</option>
  76.    <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
  77.    <option value="Dettagliato in verbale">Dettagliato in verbale</option>
  78. </select></td>
  79. <td class=blub align="center">&nbsp;</td>
  80.  
  81. <td class=blub align="center"><input type="text" name="ITEMS_1" size="5"></td>
  82. <td class=blub align="center">&nbsp;</td>
  83. <td class=blub align="center"><input type="text" name="ITEMS_KO_1" size="5"></td>
  84.  
  85. </tr>
  86.  
  87.  
  88.  
  89. <tr>
  90.    <td class=blub align="center">&nbsp;</td>
  91.    <td class=blub align="center">&nbsp;</td>
  92.    <td class=blub align="center">&nbsp;</td>
  93.    <td class=blub align="center">&nbsp;</td>
  94.    <td class=blub align="center">&nbsp;</td>
  95.    <td class=blub align="center">&nbsp;</td>
  96.    <td class=blub align="center">&nbsp;</td>
  97.    <td class=blub align="center">&nbsp;</td>
  98. </tr>   
  99.  
  100. <tr>
  101.    <td class=blub align="center">CS20</td>
  102.    <td class=blub align="center">&nbsp;</td>
  103.    <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_2" value="CS20"></td>
  104.    <td class=blub align="center">&nbsp;</td>
  105.    <td class=blub align="center">
  106.  
  107. <select size="1" name="Esito">
  108.    <option>Seleziona Esito</option>
  109.    <option value="Sufficiente">Sufficiente</option>
  110.    <option value="Insufficiente">Insufficiente</option>
  111.    <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
  112.    <option value="Dettagliato in verbale">Dettagliato in verbale</option>
  113. </select></td>
  114. <td class=blub align="center">&nbsp;</td>
  115.  
  116. <td class=blub align="center"><input type="text" name="ITEMS_2" size="5"></td>
  117. <td class=blub align="center">&nbsp;</td>
  118. <td class=blub align="center"><input type="text" name="ITEMS_KO_2" size="5"></td>
  119.  
  120. </tr>
  121.  
  122.  
  123.  
  124. <tr>
  125.    <td class=blub align="center">&nbsp;</td>
  126.    <td class=blub align="center">&nbsp;</td>
  127.    <td class=blub align="center">&nbsp;</td>
  128.    <td class=blub align="center">&nbsp;</td>
  129.    <td class=blub align="center">&nbsp;</td>
  130.    <td class=blub align="center">&nbsp;</td>
  131.    <td class=blub align="center">&nbsp;</td>
  132.    <td class=blub align="center">&nbsp;</td>
  133. </tr>   
  134.  
  135. <tr>
  136.    <td class=blub align="center">NCS24</td>
  137.    <td class=blub align="center">&nbsp;</td>
  138.    <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_3" value="NCS24"></td>
  139.    <td class=blub align="center">&nbsp;</td>
  140.    <td class=blub align="center">
  141.  
  142. <select size="1" name="Esito">
  143.    <option>Seleziona Esito</option>
  144.    <option value="Sufficiente">Sufficiente</option>
  145.    <option value="Insufficiente">Insufficiente</option>
  146.    <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
  147.    <option value="Dettagliato in verbale">Dettagliato in verbale</option>
  148. </select></td>
  149. <td class=blub align="center">&nbsp;</td>
  150.  
  151. <td class=blub align="center"><input type="text" name="ITEMS_3" size="5"></td>
  152. <td class=blub align="center">&nbsp;</td>
  153. <td class=blub align="center"><input type="text" name="ITEMS_KO_3" size="5"></td>
  154.  
  155. </tr>
  156.  
  157.  
  158.  
  159. <tr>
  160.    <td class=blub align="center">&nbsp;</td>
  161.    <td class=blub align="center">&nbsp;</td>
  162.    <td class=blub align="center">&nbsp;</td>
  163.    <td class=blub align="center">&nbsp;</td>
  164.    <td class=blub align="center">&nbsp;</td>
  165.    <td class=blub align="center">&nbsp;</td>
  166.    <td class=blub align="center">&nbsp;</td>
  167.    <td class=blub align="center">&nbsp;</td>
  168. </tr>   
  169.  
  170. <tr>
  171.    <td class=blub align="center">NCS25</td>
  172.    <td class=blub align="center">&nbsp;</td>
  173.    <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_4" value="NCS25"></td>
  174.    <td class=blub align="center">&nbsp;</td>
  175.    <td class=blub align="center">
  176.  
  177. <select size="1" name="Esito">
  178.    <option>Seleziona Esito</option>
  179.    <option value="Sufficiente">Sufficiente</option>
  180.    <option value="Insufficiente">Insufficiente</option>
  181.    <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
  182.    <option value="Dettagliato in verbale">Dettagliato in verbale</option>
  183. </select></td>
  184. <td class=blub align="center">&nbsp;</td>
  185.  
  186. <td class=blub align="center"><input type="text" name="ITEMS_4" size="5"></td>
  187. <td class=blub align="center">&nbsp;</td>
  188. <td class=blub align="center"><input type="text" name="ITEMS_KO_4" size="5"></td>
  189.  
  190. </tr>
  191.  
  192.  
  193.  
  194. <tr>
  195.    <td class=blub align="center">&nbsp;</td>
  196.    <td class=blub align="center">&nbsp;</td>
  197.    <td class=blub align="center">&nbsp;</td>
  198.    <td class=blub align="center">&nbsp;</td>
  199.    <td class=blub align="center">&nbsp;</td>
  200.    <td class=blub align="center">&nbsp;</td>
  201.    <td class=blub align="center">&nbsp;</td>
  202.    <td class=blub align="center">&nbsp;</td>
  203. </tr>   
  204.  
  205. <tr>
  206.    <td class=blub align="center">CS21</td>
  207.    <td class=blub align="center">&nbsp;</td>
  208.    <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_5" value="CS21"></td>
  209.    <td class=blub align="center">&nbsp;</td>
  210.    <td class=blub align="center">
  211.  
  212. <select size="1" name="Esito">
  213.    <option>Seleziona Esito</option>
  214.    <option value="Sufficiente">Sufficiente</option>
  215.    <option value="Insufficiente">Insufficiente</option>
  216.    <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
  217.    <option value="Dettagliato in verbale">Dettagliato in verbale</option>
  218. </select></td>
  219. <td class=blub align="center">&nbsp;</td>
  220.  
  221. <td class=blub align="center"><input type="text" name="ITEMS_5" size="5"></td>
  222. <td class=blub align="center">&nbsp;</td>
  223. <td class=blub align="center"><input type="text" name="ITEMS_KO_5" size="5"></td>
  224.  
  225. </tr>
  226.  
  227.  
  228.  
  229. <tr>
  230.    <td class=blub align="center">&nbsp;</td>
  231.    <td class=blub align="center">&nbsp;</td>
  232.    <td class=blub align="center">&nbsp;</td>
  233.    <td class=blub align="center">&nbsp;</td>
  234.    <td class=blub align="center">&nbsp;</td>
  235.    <td class=blub align="center">&nbsp;</td>
  236.    <td class=blub align="center">&nbsp;</td>
  237.    <td class=blub align="center">&nbsp;</td>
  238. </tr>   
  239.  
  240. <tr>
  241.    <td class=blub align="center">CS29</td>
  242.    <td class=blub align="center">&nbsp;</td>
  243.    <td class=blub align="center"><input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_6" value="CS29"></td>
  244.    <td class=blub align="center">&nbsp;</td>
  245.    <td class=blub align="center">
  246.  
  247. <select size="1" name="Esito">
  248.    <option>Seleziona Esito</option>
  249.    <option value="Sufficiente">Sufficiente</option>
  250.    <option value="Insufficiente">Insufficiente</option>
  251.    <option value="Sufficiente con osservazioni">Sufficiente con osservazioni</option>
  252.    <option value="Dettagliato in verbale">Dettagliato in verbale</option>
  253. </select></td>
  254. <td class=blub align="center">&nbsp;</td>
  255.  
  256. <td class=blub align="center"><input type="text" name="ITEMS_6" size="5"></td>
  257. <td class=blub align="center">&nbsp;</td>
  258. <td class=blub align="center"><input type="text" name="ITEMS_KO_6" size="5"></td>
  259.  
  260. </tr>
  261.  
  262.  
  263.  
  264.   </td>
  265.     </tr>
  266.  
  267. <tr>
  268.    <td class=blub align="center">&nbsp;</td>
  269.    <td class=blub align="center">&nbsp;</td>
  270.    <td class=blub align="center">&nbsp;</td>
  271.    <td class=blub align="center">&nbsp;</td>
  272.    <td class=blub align="center">
  273.  
  274. &nbsp;</td>
  275. <td class=blub align="center">&nbsp;</td>
  276.  
  277. <td class=blub align="center">&nbsp;</td>
  278. <td class=blub align="center">&nbsp;</td>
  279. <td class=blub align="center">&nbsp;</td>
  280.  
  281. </tr>
  282.  
  283. <tr>
  284.    <td class=blub align="center" colspan="9">
  285.    <div align="center">
  286.      <table border="0" id="table3">
  287.        <tr>
  288.          <td><p align="center">
  289.             <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)">
  290.             <img border="0" src="salva_button.gif" width="84" height="16"></a></td>
  291.          <td>&nbsp;</td>
  292.          <td><p align="center"><a href="javascript:void(0);" onclick="window.close()">
  293.              <input type="image"src="chiudi_button.gif" border="0" align="middle" name="I5"></a></td>
  294.        </tr>
  295.      </table>
  296.    </div>
  297.    </td>
  298.  
  299. </tr>
  300.  
  301. <tr>
  302.    <td class=blub align="center">&nbsp;</td>
  303.    <td class=blub align="center">&nbsp;</td>
  304.    <td class=blub align="center">&nbsp;</td>
  305.    <td class=blub align="center">&nbsp;</td>
  306.    <td class=blub align="center">
  307.  
  308. &nbsp;</td>
  309. <td class=blub align="center">&nbsp;</td>
  310.  
  311. <td class=blub align="center">&nbsp;</td>
  312. <td class=blub align="center">&nbsp;</td>
  313. <td class=blub align="center">&nbsp;</td>
  314.  
  315. </tr>
  316.  
  317.   </table>
  318. </div>
  319.  
  320. </form>
  321.  
  322. </body>
  323. </html>
  324.  
  325.  
Sep 4 '08 #6

acoder
Expert Mod 15k+
P: 16,027
The problem is line 286:
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO  _VERIFICA_6.value+';'+document.myform.Esito.value+  ';'+document.myform.ITEMS_6.value+';'+document.myf  orm.ITEMS_KO_6.value)">
What do you actually want to happen? For example, if I select checkbox 1, do you want anything to appear, or do you always want to pass the last row data?
Sep 4 '08 #7

P: 66
The problem is line 286:
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO  _VERIFICA_6.value+';'+document.myform.Esito.value+  ';'+document.myform.ITEMS_6.value+';'+document.myf  orm.ITEMS_KO_6.value)">
What do you actually want to happen? For example, if I select checkbox 1, do you want anything to appear, or do you always want to pass the last row data?
Ok I understand.

I need insert in the string:

Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:insertf1(document.myform.SOTTODETTAGLIO  _VERIFICA_6.value+';'+document.myform.Esito.value+  ';'+document.myform.ITEMS_6.value+';'+document.myf  orm.ITEMS_KO_6.value)">
all the values selected in the secondary form and insert this string in the hidden field of the main form; whether a value or more values.
Sep 4 '08 #8

acoder
Expert Mod 15k+
P: 16,027
Is there a particular reason why the elements are named differently? You can use the same name, just not the same ID. If you have the same name, you can use document.getElementsByName() to get a list/array of elements which you can loop over. Check the checked property of the checkboxes to see if that row is one of the selected ones to pass the values through.
Sep 4 '08 #9

P: 66
Is there a particular reason why the elements are named differently? You can use the same name, just not the same ID. If you have the same name, you can use document.getElementsByName() to get a list/array of elements which you can loop over. Check the checked property of the checkboxes to see if that row is one of the selected ones to pass the values through.

Ok, I try this but response with error 'Object required', why?:


Expand|Select|Wrap|Line Numbers
  1.  
  2. function insertf1(stringa) 
  3.  
  4. {
  5.  
  6.    var s = "";
  7.    for( var i = 0; i < 7; i++)
  8.  
  9.   {
  10.  
  11.       s += "," + document.getElementById('test_'+i).value;
  12.  
  13.    }   
  14.         window.opener.document.myform.dati_aggiuntivi.value=s;
  15.  
  16.         return s.substr();
  17.  
  18. }
  19.  
  20. <select size="1" id=test_1" name="test_1">
  21. ...
  22. </select>
  23.  
  24. <select size="1" id=test_2" name="test_2">
  25. ...
  26. </select>
  27.  
  28. <select size="1" id=test_3" name="test_3">
  29. ...
  30. </select>
  31.  
  32. <input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_1" value="NCS43">
  33.  
  34. <input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_2" value="NCS44">
  35.  
  36. <input type="checkbox" name="SOTTODETTAGLIO_VERIFICA_3" value="NCS28">
  37.  
  38. <a href="#" onclick="insertf1();return false;">
  39.  
  40.  
Sep 4 '08 #10

acoder
Expert Mod 15k+
P: 16,027
You're starting from 0 and the IDs start from 1.
Sep 4 '08 #11

P: 66
You're starting from 0 and the IDs start from 1.
Error not change:

Expand|Select|Wrap|Line Numbers
  1. function insertf1(stringa) 
  2.  
  3. {
  4.  
  5.    var s = "";
  6.    for( var i = 1; i < 7; i++)
  7.  
  8.   {
  9.  
  10.       s += "," + document.getElementById('test_'+i).value;
  11.  
  12.    }   
  13.         window.opener.document.myform.dati_aggiuntivi.value = s;
  14.  
  15.         return s.substr();
  16.  
  17. }
  18.  
  19.  
Sep 4 '08 #12

acoder
Expert Mod 15k+
P: 16,027
You're not passing anything to insertF1, so you can remove stringa.

In the above code, you have only 3 elements while the loop loops till 6.
Sep 4 '08 #13

P: 66
You're not passing anything to insertF1, so you can remove stringa.

In the above code, you have only 3 elements while the loop loops till 6.
Sorry, I don't understand.

I do not know how many fields I will have on the form secondary...
Sep 4 '08 #14

acoder
Expert Mod 15k+
P: 16,027
Then the 7 should be replaced by a dynamic value generated from the server-side which changes depending on the number of fields.
Sep 4 '08 #15

P: 66
Then the 7 should be replaced by a dynamic value generated from the server-side which changes depending on the number of fields.

Yes but this is already done:

Expand|Select|Wrap|Line Numbers
  1.  
  2. function insertf1(stringa) 
  3.  
  4. {
  5.  
  6.    var s = "";
  7.    for( var i = 1; i < 7; i++)
  8.  
  9.   {
  10.  
  11.       s += "," + document.getElementById('test_'+i).value;
  12.  
  13.    }   
  14.         window.opener.document.myform.dati_aggiuntivi.valu  e = s;
  15.  
  16.         return s.substr();
  17.  
  18. }
  19.  
  20. ...
  21.  
  22. <form name="form">
  23.  
  24. <% 
  25.   rs.MoveFirst()
  26.   Do While Not rs.EOF    
  27. %>
  28.  
  29.  
  30. <input type="checkbox" name="DETTAGLIO" value="<%=rs("DETTAGLIO")%>">
  31.  
  32. <select size="1" id="test_<%=list%>" name="test_<%=list%>">
  33. ...
  34. </select>
  35.  
  36. <select size="1" id="test_<%=list%>" name="test_<%=list%>">
  37. ...
  38. </select>
  39.  
  40. <select size="1" id="test_<%=list%>" name="test_<%=list%>">
  41. ...
  42. </select>
  43. ...
  44.  
  45.  
  46. <%  
  47.     rs.MoveNext()
  48.   Loop
  49. %>
  50.  
  51. ...
  52.  
  53. <a href="#" onclick="insertf1();return false;">
  54.  
  55.  
Sep 4 '08 #16

acoder
Expert Mod 15k+
P: 16,027
I meant on line 6, the 7 should be replaced by a dynamic value.

You have three select elements, but the code loops till 6, so it would be trying to access "test_4", "test_5", "test_6" which don't exist.
Sep 4 '08 #17

P: 66
I meant on line 6, the 7 should be replaced by a dynamic value.

You have three select elements, but the code loops till 6, so it would be trying to access "test_4", "test_5", "test_6" which don't exist.
OK, please acoder try this page htm:

http://users1.titanichost.com/MiguelRivero61/
Sep 4 '08 #18

acoder
Expert Mod 15k+
P: 16,027
I don't think you've made any changes since the last time I checked. The code looks and behaves the same.

If you're using unique IDs, use document.getElementById(). If you're using names, use document.getElementsByName(). Alternatively, you could use document.getElementsByTagName("input") and then check the type/name.
Sep 4 '08 #19

P: 66
I don't think you've made any changes since the last time I checked. The code looks and behaves the same.

If you're using unique IDs, use document.getElementById(). If you're using names, use document.getElementsByName(). Alternatively, you could use document.getElementsByTagName("input") and then check the type/name.

Your help is not the help I think
However, thanks.
Sep 4 '08 #20

acoder
Expert Mod 15k+
P: 16,027
Something lost in translation?

I've seen the link, but the changes that you're showing in this thread are not reflected in the link. Also, the popup page is a .html file while you've shown that you're using ASP.
Sep 4 '08 #21

P: 66
Something lost in translation?

I've seen the link, but the changes that you're showing in this thread are not reflected in the link. Also, the popup page is a .html file while you've shown that you're using ASP.
No problem acoder, problem solved:

Expand|Select|Wrap|Line Numbers
  1.  
  2. function Re(){
  3.  
  4. var f=document.getElementById('id_form')
  5. var stringa=''
  6.  
  7. for(var k=0;k<f.elements.length;k++){
  8.   stringa+=f.elements[k].value+',';
  9. }
  10.  
  11.   window.opener.document.myform.dati_aggiuntivi.value = stringa
  12.   alert("OK!");
  13.   window.close();
  14.  
  15. }
  16.  
  17. ...
  18.  
  19. <form id="id_form" name="myform">
  20.  
  21. ...
  22.  
  23. <a href="#" onclick="Re();">...</a>
  24.  
Sep 5 '08 #22

acoder
Expert Mod 15k+
P: 16,027
Oh, so you wanted all the fields in the form?

Anyway, glad to hear that you've managed to solve it.
Sep 5 '08 #23

Post your reply

Sign in to post your reply or Sign up for a free account.