Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Href and submit

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
hi guys
in the below code i have an href with an onclick. what i am tryig to do is call another page an insert it into frame 3. The page in frame 2 is to be called and have a blank clientcode submitted to clear the index out of the frame.

i keep getting an error on the submit part. what have i got wrong?



function ClearIndex(){
document.form1.clcode.value="";
document.form1.submit();
}
</script>
<body bgColor=#ffcc66 scrolling = no >

<Form id=form1 name=form1 method=post action=index1.asp
target = idx1 onSubmit = validate();>
Enter client code:<br>
<input name = clcode size = 7 maxlength = 4 ><br>

<p><input type = Submit name = submit value = Submit>
</P>
</form>
<A href=ReportStatus1.asp target = main onClick = &quot;javascript:ClearIndex()&quot;>Status Report</a>
</body></html>


tia

bastien
 
I think if you use javascript, you have to enclose it in double quotes???

onSubmit =&quot;validate();&quot;>

don't know that that's it, but haven't ever seen it done without them.

:)
 
Hi Paul

There is no OnSubmit...I am using an onClick function to asign a value to the clcode and using the fucntion to submit the form...

Bastien
 
Then what is this???


<Form id=form1 name=form1 method=post action=index1.asp
target = idx1 onSubmit = validate();>


Came from your original post??
 
Hi paul,

so what you're indicating is that I have a collision between the code for the onSubmit for the form and the onCLick for the HREF...is there a way around this??
It is the HREF that I have the problem with currently...

thanks

bastien
 
Well, I see no validate() function in your post -- does such a function exist on your page???

The error that I'm getting when I execute your code up there is &quot;object expected&quot; -- which tells me that it's looking for a function on the page, validate(), but there is none --

Without seeing the rest of the code for your page, I would try this:

<html>
<head>
<title>Hiding Tables</title>
</head>
<script language=javascript>
function ClearIndex(){
document.form1.clcode.value=&quot;&quot;;
document.form1.submit();
}
</script>
<body bgColor=#ffcc66 scrolling = no >

<Form id=form1 name=form1 method=post action=index1.asp
target = idx1>
Enter client code:<br>
<input name = clcode size = 7 maxlength = 4 ><br>

<p><input type = Submit name = submit value = Submit>
</P>
</form>
<A href=ReportStatus1.asp target = main onClick = &quot;javascript:ClearIndex()&quot;>Status Report</a>
</body></html>

basically, I just took out the onSubmit=validate() part of your code -- it then executed without any errors.

:)
Paul Prewett
 
Hi bastien,

the problem is in this line,
<input type = Submit name = submit value = Submit>
you need to avoid to use the name &quot;submit&quot; for your submit button, cuz when you call the &quot;document.form1.submit();&quot; javascript think you need to do something with the button &quot;submit&quot;. To fix this bug, simply rename the submit button, for example:
<input type=&quot;Submit&quot; name=&quot;SubmitButton&quot; value=&quot;Submit&quot;>

hope this helps,
Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top