Click to See Complete Forum and Search --> : Form Submission problem


raghu
04-11-2003, 01:19 PM
Hi,

I have a two forms in a page called lower and upper forms.
I Need to submit the upper form always based on lower form value.If the lower form text box value is "abc" (Default value)then I should not submit the upper form and return false.

But when I try to submit the form with the default value("abc"), then i get a blank screen with false printed.



Here is the sample code


<html>
<head>
<script>

function callnow()
{

if (document.frmlower.txtlower.value =="abc")
{
return false;
}
else
{
document.frmupper.method="post";
//alert(document.frmupper.action);
document.frmupper.action="testres.asp";
document.frmupper.submit();
}
//document.frmlower.submit();
//return true;
}


</script>

</head>
<form name="frmupper" id="frmupper" >
Upper Form <input type="hidden" name="h1" value="inital"> <input type="text" name="txtupper" value="123">
<!--<input type="button" name="add" value="add" onclick="test();">-->
<br />

<br>

</form>
<form name="frmlower" ID="frmlower">
<!--<input type="image" name="submit" value="submit" ID="Image1" onclick="callnow();"/>-->
LOWER FORM<input type="text" name="txtlower" value="abc" ID="Text1">
<a href="javascript:callnow();"><img src="" alt="image"></a>
</form>
</html>


Thanks in advance.

khalidali63
04-11-2003, 02:06 PM
Get rid of the anchor tag around the image and instead of this

<a href="javascript:callnow();"><img src="" alt="image"></a>

use it like this
<img src="" alt="image" onclick="javascript:callnow();">


Cheers

Khalid

requestcode
04-11-2003, 02:17 PM
Try changing it to this:
<a href="#" onClick="return callnow()"><img src="" alt="image"></a>

You need to have "return" before your function call so that it can detect the false or true being returned.

raghu
04-11-2003, 02:30 PM
It works,but only problem is that
the hand icon should be shown on mouse-over.

How can we do that??


Thanks in advance.