473,788 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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
2 1451
godkrishna
2 New Member
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
16,027 Recognized Expert Moderator MVP
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

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

Similar topics

10
2121
by: Dave Karmens | last post by:
If I have say 10 fixed variables, how can I set their values = to that of a form that is built dynamically? column1 column2 email = formvalue(0) fname = formvalue(1) lname = formvalue(2) etc..
5
3469
by: Nick Calladine | last post by:
Learning : Loop to list all dropdown box values on a form Can some one point me in the right direction : I have a form which I want to loop through I basically want to get all the selected values of the option tag see example below
10
3478
by: Mr Newbie | last post by:
DropDown lists and Listboxes do not appear in the list of controls and values passed back to the server on PostBack in Request.Form object. Can someone confirm this to be correct and possibly answer why ? The impact of this is that values added via javascript will never make it back to the server side code unless one does some jiggery pokery with hidden fields etc. If this is true, then I would like to understand the reason behind the...
4
2716
by: assgar | last post by:
Hi I am stuck on a problem. I use 3 scripts(form, function and process). Development on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply.
2
7053
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money. Note The above informaton is...
4
2635
by: Greg Scharlemann | last post by:
I'm trying to setup a dyamic dropdown list that displays a number of text fields based on the selected number in the dropdown. The problem I am running into is capturing the data already entered before the list is repopulated. For example, suppose the user selects 3 in the drop down list and 3 text fields are shown. If the user populates the 3 text fields with data and decides to change the drop down to a list of 4 or 5, how do I capture...
12
16278
by: Larry L [in Honolulu] | last post by:
I have a dropdown list dynamically created in a form by PHP from a MySql table. This is the only element on the page. For some records there is only a single selection, and if that's the case I'd like to just post that and go to the next page. Is there a simple way to do that using POST? I know how to do it with GET, but don't like the resulting URLs. Or is there a simpler method I'm not thinking about? Thanks, Larry
0
3396
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options within options. I have everything being dynamically named from the previously dynamically named element. (I hope this makes sense.) I am not able to retrieve any of the dynamically created values. I can view them on the source page but can't pull them...
1
1952
by: hotrod57 | last post by:
I am trying to append the results from a form to a text file. My code is supposed to print out the results on one page, and append the results to another page each time data is entered on the form and the submit button is hit. Unfortunately, it is only printing out the message acknowledging the submit button--no data on either form. Here is the code below, please help if you can. PHP code that reads the form submission: <?php function...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.