473,811 Members | 2,240 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 71230
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
6159
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
5492
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
4049
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
5500
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
3011
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
4926
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
6094
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
2177
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
6110
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
2192
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
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10652
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
10395
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
10408
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
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
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...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.