Ka**********@attbi.com (KathyB) writes:
<form name="finish" action="Hidden_Birth2.aspx" method="post"
onsubmit="return CheckInput(this);">
You send the form to CheckInput as an argument, but doesn't use it.
<input style="CURSOR: HAND" type="submit" name="finish"
value="FINISH"/>
You appear to use XHTML. I would put a space before the final "/>",
just to not confuze older non-XHTML browsers.
The correct CSS for what you want is "cursor:pointer". The "hand" is
an IE invention. For backwards compatability with IE 4, you can use both,
with "hand" last.
function CheckInput()
function CheckInput(form)
(you pass the form anyway)
{
var cnAll = document.all;
for (var i=0;i<cnAll.length;i++)
{
if(cnAll(i).tagName=='input' && cnAll(i).type=='text')
document.all is a collection, so you might want to use it as such, and
not as a function. I.e., "cnAll[i]" instead of "cnAll(i)".
You want to iterate through all the elements of the page and
find the ones that are input elements with type "text". There
are faster ways to do that (especially if you only check inside
the form):
var inputs = (form.getElementsByTagName?
form.getElementsByTagName("input"):
form.all.tags("input")); // for IE 4
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "text")
{
alert("You must first complete and SAVE all user inputs!");
return false; }
}
}
...seems to work as far as checking for the elements (type=text), but
if it does not return false; the action of the form (loading the aspx
page) doesn't seem to work. I'm working in asp.net, and I just get a
blank page.
So the form *is* submitted, the asp.net just doesn't give the result
you expected. That probably means that the bug is in the asp code.
Since it is in the hmtl and if the js fails, still can't
figure out HOW to find the problem...since it just quits.
You can try making an asp page that displays the form elements
that are submitted, and set the form to point to that page. Then
you can see what is submitted.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'