473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

<snip code>
else if (document.RFO.arow.value != 1) {
for(i=document.RFO.arow.value; i > 1 ; i--){
if (''==document.RFO.elements['acc_tot_' + i].value){
alert("Need Amount For Each Account Used");
document.RFO.elements['acc_tot_' + i].focus();
}
else {
setCookie();
document.RFO.submit();
}
}
}
<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 1128
ab*******@hotmail.com writes:
<snip code>
else if (document.RFO.arow.value != 1) {
for(i=document.RFO.arow.value; i > 1 ; i--){
if (''==document.RFO.elements['acc_tot_' + i].value){
alert("Need Amount For Each Account Used");
document.RFO.elements['acc_tot_' + i].focus();
}
else {
setCookie();
document.RFO.submit();
}
}
}
<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.arow.value != 1) {
for(i=document.RFO.arow.value; i > 1 ; i--){
if (''==document.RFO.elements['acc_tot_' + i].value){
alert("Need Amount For Each Account Used");
document.RFO.elements['acc_tot_' + i].focus();
break;
}
else {
setCookie();
document.RFO.submit();
}
}
}
<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
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...
1
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...
3
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...
0
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...
1
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...
2
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...
3
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...

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.