473,574 Members | 2,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

submiting in else...not working the way I want

<snip code>
else if (document.RFO.a row.value != 1) {
for(i=document. RFO.arow.value; i > 1 ; i--){
if (''==document.R FO.elements['acc_tot_' + i].value){
alert("Need Amount For Each Account Used");
document.RFO.el ements['acc_tot_' + i].focus();
}
else {
setCookie();
document.RFO.su bmit();
}
}
}
<snip code>

My brain is mush...one problem fixed...which brings up another.
I they only use two accounts,
if acc_tot_2 is null they get an alert message then the focus goes to it.

However, if they use more than 2 accounts,
if acc_tot_3 is null they get an alert message...but because acc_tot_2 was
not null the form is submited.

How do I rewrite this to handle more than two acc_tot_? fields?
Jul 20 '05 #1
1 1133
ab*******@hotma il.com writes:
<snip code>
else if (document.RFO.a row.value != 1) {
for(i=document. RFO.arow.value; i > 1 ; i--){
if (''==document.R FO.elements['acc_tot_' + i].value){
alert("Need Amount For Each Account Used");
document.RFO.el ements['acc_tot_' + i].focus();
}
else {
setCookie();
document.RFO.su bmit();
}
}
}
<snip code>

My brain is mush...one problem fixed...which brings up another.
I they only use two accounts,
if acc_tot_2 is null they get an alert message then the focus goes to it.

However, if they use more than 2 accounts,
if acc_tot_3 is null they get an alert message...but because acc_tot_2 was
not null the form is submited.

How do I rewrite this to handle more than two acc_tot_? fields?


I put a break in thinking that would help.
<snip code>
else if (document.RFO.a row.value != 1) {
for(i=document. RFO.arow.value; i > 1 ; i--){
if (''==document.R FO.elements['acc_tot_' + i].value){
alert("Need Amount For Each Account Used");
document.RFO.el ements['acc_tot_' + i].focus();
break;
}
else {
setCookie();
document.RFO.su bmit();
}
}
}
<snip code>

Now it works fine if it's the last acc_tot_, but if it's not the first (which
I don't need to check) and the last the page gets submited. Any help
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2791
by: Bartosz Wegrzyn | last post by:
Please look at my code. I do validation of my form before I submit it. I want to be able to to press one form button without running validating script. I just want to go directly to my php script. I tried to do this onclick="document.form1.submit()" but than the button value is not posted and my php script is not working.
1
1396
by: Pat | last post by:
Here is how I have been submiting a form to a popup window, this works fine for all netscape versions and all IE versions previous to 6.0.2800.1106. Does anyone know a different way I can submit a form to a popup window? ------------------------------------------------ <script language="JavaScript"> function new_window() { // Reference...
3
3119
by: webserverpete | last post by:
I am new to ASP.NET in general, but I do have experience with classic ASP. I am using a DataList control with a hidden value to submit to a different page, however I do not know how to get to that hidden value. Here is my DataList control code: <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" RepeatColumns="4">...
0
1127
by: pankaj1703 | last post by:
i am create one enquiry form after submiting the information fillup by the end user then it get thanks message. if it press back button it go to the enquiry form fill by him that i want to prevent any solution for this ...
1
1355
by: divjari | last post by:
Hi all... I have two dropdowns on my form and form contain records from database table. On change of each dropdown i m submitting form and data of forms are refreshed according to value selected from dropdown. Now when first dropdown is changed its working fine and data are filtered according to selected value ...but as i m trying to change...
2
5855
by: blitzztriger | last post by:
Hello!! how do i insert values into mysql , after parsing a submiting textbox?? I made the arrays, so this should be a basic insertion of them in the db, but something is missing, or in the wrong place...can anyone help me?? i didnt made anything in the VALUES (unless the POST ), because i bet the error is there (yes, the arrays are...
3
1411
Ajm113
by: Ajm113 | last post by:
Ok for some reason after the update of Firefox it seems that my form keeps getting submitted when the user made a error on the form. I just want the page to reload so the user may try again. Because I have it so the submit button is a hit once only. Here is the code: <SCRIPT LANGUAGE="JavaScript"> function validateForm(form) { if...
5
1880
by: rodrigo21 | last post by:
I have a form that submits the form values to the same page (of the form). The database is feed from the same page that have the form in it. So the action attribute would look like this <form action="samepage.php" Right now, after submiting, the same form opens, so the user dont know if his record was submited. Saying this. How can I...
0
7710
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...
0
8225
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...
0
8092
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...
1
5610
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...
0
5296
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...
0
3738
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...
0
3745
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2230
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
0
1051
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...

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.