473,386 Members | 1,610 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,386 software developers and data experts.

Problem getting function to return false

I have 2 functions, the first one, "GetSelectedItem" is determining which radio button was selected and running the "formvalidation" function if needed. This is working fine. My problem is getting the entire form to return false if "formvalidation" is false. I can't figure out how to have "GetSelectedItem" return false if "formvalidation" is false. I've tried a bunch of methods I've found, but I keep getting it wrong.

Any help would be greatly appreciated! Here is what I have:


<script language="JavaScript" type="text/JavaScript"><!--

function GetSelectedItem() {
chosen = ""
len = document.form.item_LabelShip.length
for (i = 0; i <len; i++) {
if (document.form.item_LabelShip[i].checked) {
chosen = document.form.item_LabelShip[i].id
}
}
if (chosen == "ExpressShip") {formvalidation(this)}
}



function formvalidation()
{
with (document.form.ShipperAcctNumber)
{
if (value == null || value == "")
{alert("For overnight FedEx/DHL shipping, you must enter an account number.");return false}
else {return true}
}
}


//--></script><form name="form" onsubmit="return GetSelectedItem()" action="http://www.cartserver.com/sc/cart.cgi" method="post">
Apr 30 '07 #1
2 1690
iam_clint
1,208 Expert 1GB
if (chosen == "ExpressShip") {formvalidation(this)}

if (chosen == "ExpressShip") { return formvalidation(this); }
Apr 30 '07 #2
Clint, you are my new hero!!! Thank you!
May 1 '07 #3

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

Similar topics

1
by: Dwayne Epps | last post by:
This is probably a no brainer, but I am having no luck at getting this to work. I'm creating functions that will validate form data fields. For example, the following function: function...
1
by: Michael J Whitmore | last post by:
I am getting tired of losing hair over this. Here is a function that simply inserts one of three images into a document right before printing. It is called for every element that has a specific...
10
by: Mark Jerde | last post by:
I'm trying to learn the very basics of using an unmanaged C++ DLL from C#. This morning I thought I was getting somewhere, successfully getting back the correct answers to a C++ " int SumArray(int...
16
by: shapper | last post by:
Hello, I have a generic list as follows: Dim rows As New Generic.List(Of row) Now I have a row: Dim myRow As row I tried to check, further in my code, if the row is nothing: If myRow Is...
1
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
1
by: rsteph | last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
0
by: jiwas78 | last post by:
Hey there. I am learning XML and Actionscript. I have a problem with getting my XML data to load when my SWF is in an HTML page in a browser. When I open the SWF on it's own whether in Flash Player...
0
by: jiwas78 | last post by:
Hey there. I am learning XML and Actionscript. I have a problem with getting my XML data to load when my SWF is in an HTML page in a browser. When I open the SWF on it's own whether in Flash Player...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.