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

form submission donot take value of dynamically added option to dropdown list

P: 2
Hi Guys.. I am new to javascript.. pls bare with me :)

In my form, i have a table with two columns. first column has checkboxes and second has dropdown lists.

On check of each check box.. certain 'options' are addded/removed from its corresponding dropdown list.

My problem is, after adding/removing the 'options' dynamically, if I select the newly added option and submit the form, the corresponding value for the newly added option is actually not getting submitted. The form is submitted with some other option in the list. In other terms, the form is not getting submitted with the correct value, if I select the newly added option.

Could any of you help me please? (Sorry that I donot know any PHP or ajax..)
Sep 24 '08 #1
Share this Question
Share on Google+
2 Replies


P: 2
Since my code is too big, let me paste you some pieces of it!!

Expand|Select|Wrap|Line Numbers
  1.  <form
  2.       name="update_all_instance"
  3.                         method="POST"
  4.                         action="/pls/EOF/Eof_Manage_Liveupdate.call_for_lu">
  5.   <br/><br/>
  6.  
  7.    <SCRIPT>
  8.      var arr1 = new Array();
  9.  
  10.        function remove_checked_instance(ischkd, inst_id) {
  11.          var y = "";
  12.          var arr2 = new Array();
  13.          var strng;
  14.          if(ischkd) {
  15.            for(i=0;i<update_all_instance.p_from_instance_id.length;i++) {
  16.               for(j=0;j<update_all_instance.p_from_instance_id(i).options.length;j++) {
  17.                 if(update_all_instance.p_from_instance_id(i).options[j].value == inst_id) {
  18.                    y = y+"|"+i;
  19.                    arr2[0] = inst_id;
  20.                    arr2[1] = update_all_instance.p_from_instance_id(i).options[j].text;
  21.                    update_all_instance.p_from_instance_id(i).remove(j);
  22.                 }
  23.               }
  24.            }
  25.            if(y == "") return;
  26.            strng = arr2.join("|");
  27.            strng = strng+y;
  28.            arr1.push(strng);
  29.          }
  30.          else {
  31.            for(k=0;k<arr1.length;k++) {
  32.              strng = arr1[k].substring(0,4);
  33.              if(strng == inst_id) {
  34.                arr2 = arr1[k].split("|");
  35.                for(j=2;j<arr2.length;j++) {
  36.                  for(i=0;i<update_all_instance.p_from_instance_id.length;i++) {
  37.                    if(arr2[j] == i) {
  38.                      y = document.createElement('option');
  39.                      y.value = inst_id;
  40.                      y.text = arr2[1];
  41.                      y.name = "p_from_instance_id";
  42.                      update_all_instance.p_from_instance_id(i).add(y);
  43.                    }
  44.                  }
  45.                }
  46.              }
  47.            }
  48.          }
  49.        }
  50.     </SCRIPT>
Sep 24 '08 #2

acoder
Expert Mod 15k+
P: 16,027
Show an example of a call to this function and some example HTML code.

PS. please use code tags when posting code. Thanks.
Sep 24 '08 #3

Post your reply

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