473,800 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript document.form.s ubmit()

3 New Member
i am trying to submit the form multipple times
within a loop, if i have an alert() coded, it works,
but, when i take the alert() out, it only does the submit the last time through the loop.
Apr 30 '06 #1
5 71227
Banfa
9,065 Recognized Expert Moderator Expert
Post the code, by your own admission it is faulty but we will have great trouble divining that fault without site of the code.
Apr 30 '06 #2
therjs
3 New Member
Expand|Select|Wrap|Line Numbers
  1. function doVote() 
  2. {
  3.     var index = 0;
  4.  
  5.     index = document.f1.numVoteItems.value;
  6.  
  7.     document.f1.action="../Parts/GeneralInfo";
  8.     document.f1.actionName.value = "DOVOTE";
  9.  
  10.      var yesRadio;
  11.     var noRadio;
  12.     var j = 1;
  13.  
  14.     for (var i = 0; i < index; i++) 
  15.     {
  16.         eval("yesRadio=document.f1.YesRadio" + j);
  17.         eval("noRadio=document.f1.NoRadio" + j);
  18.  
  19.         eval("res=document.f1.resPartNumber" + i);
  20.         eval("req=document.f1.reqPartNumber" + i);
  21.  
  22.         if (yesRadio.checked == true)
  23.         {
  24.             //alert("yes radio is checked");
  25.             document.f1.reqPartNumber.value = req.value;
  26.             document.f1.resPartNumber.value = res.value;
  27.             document.f1.vote.value = "Y";
  28.             document.f1.submit();
  29.             //alert('should have done an update');
  30.         }
  31.  
  32.         if (noRadio.checked == true)
  33.         {
  34.             //alert("no radio is checked");
  35.             document.f1.reqPartNumber.value = req.value;
  36.             document.f1.resPartNumber.value = res.value;
  37.             document.f1.vote.value = "N";
  38.             document.f1.submit();
  39.             //alert('should have done an update');
  40.         }
  41.  
  42.         j = j + 1;
  43.     }
  44. }
May 1 '06 #3
Banfa
9,065 Recognized Expert Moderator Expert
I suspect (although I don't know) that you are running some sort of undefined behaviour. I do not think that you are supposed to be able to submit a single form multiple times because as soon as you submit a form you start loading the result of that submission.

Quite how you would see the results of multiple submission I am not sure.

I suspect in the case of having the alerts in that the form being submitted is not being cleared striaght away indavertently allowing it to be submitted multiple times in the version of the browser you are using. I suspect this is a feature rather than designed behaviour and that you are not garunteed that it will always be there in a new version or different browser.

Looking at you code it looks like all the information required is on the form and without knowing more about what you are trying to achieve I would say that it should be possible to do what you want from a single submit letting the receiving page handle sorting out all the data server side rather than trying to do it client side.
May 2 '06 #4
therjs
3 New Member
well, i think that i need to set up the receiving servlet to handle an array of values, rather than trying to submit the form multiple times.
May 2 '06 #5
Banfa
9,065 Recognized Expert Moderator Expert
well, i think that i need to set up the receiving servlet to handle an array of values, rather than trying to submit the form multiple times.
I agree :)
May 2 '06 #6

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

Similar topics

2
6156
by: Miles Davenport | last post by:
My Javascript is rather rusty :( ... and I need to do change some form values, in the folowing way: (1). I have the following a href (wrapped in PHP), which calls processForm. ==== <input type="hidden" name="myHiddenValue"> href="javascript:void(0)" onClick="processForm(\'' . $form_name
4
5484
by: houstoncity2004 | last post by:
Hi, I need help to JavaScript. I am new to this, and am trying to the page online ASAP. I have two submit buttons on one form, and each button will have to do different things. I named both button "but1". The first button has the value "Continue", the second button has the value "new page". If someone click on the button with the value "Continue", I need to check if certain information has been filled in before proceeding, and if...
6
4045
by: Joop | last post by:
Hi all, I'm kinda new to JavaScript, but hey... I'm trying anyway! ;-) So, here's my problem : I've created a table in my document, presenting a list of items, one can 'select' by clicking on it... (Kinda like a menu, you make your choice from) But since this table can get very long, I've put something of a 'search-form' on top, which enables the user to make a
14
5486
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
11
3009
by: Brian D | last post by:
I have been searching for a while to find an answer to this and I must be searching on the wrong keywords. Below is a snippet of my form. There are other form items on it, but I need to submit a different value based on the image that is clicked. Lets say the name is "image" and the value is . How do I submit this with javascript? <form name="form1" method="post" action="launch.asp">
9
4923
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
10
6093
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get different results than when I use a javascript submit: form1.submit();. I think the javascript submit is working as it should, since I want the server to process an __EVENTTARGET posting. When I click the submit button, it does not process the...
1
2175
by: dreamlab | last post by:
Hello, Can one of you javascript wizards help out a newbie, please? I’ve got a formHandler that is supposed to check for a good email address and name in the form after clicking the submit link and display a status error message above the form if either the E-mail and/or Name fields are blank, but instead the page does nothing. I think that the Submit link in the code below is probably the root of the problem: <a href="javascript:;"...
10
6106
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
14
2190
by: Mtek | last post by:
Hi, We have a form defined with buttons like this: <a class="save_menu" href="javascript:document.Detail_Screen.action = 'savedata.php?screen=EDIT';document.Detail_Screen.submit();">Update</ a> The form also has an onSubmit action to vall a validation routine:
0
10501
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...
0
10273
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10250
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
9085
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
6811
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
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
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.