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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form won't submit 1

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
any solutions as to why this form does not submit:
Code:
<html><head>

</head><body>
<form name="registrationFrm" action="validate.asp" method="post">

<some hidden values..here......>						

	<p align="center">
								&nbsp;<p align="center">
								Your information has been validated, please click 
								the button below to begin the survey.<p align="center">
								<input name="submit" type="submit">


</form>
</body>
</html>

<script>
window.onload = setFocus;
function setFocus(){
document.registrationFrm.submit();
}
</script>
 
Just do this.

Code:
<script type="text/javascript">
<!--//
setFocus();

function setFocus(){
     document.registrationFrm.submit();
}
//-->
</script>

or even better

Code:
<script type="text/javascript">
<!--//
document.registrationFrm.submit();
//-->
</script>

 
either way it doesn't work i get an error of
"Object does not support this property or method"


 
this is the full asp page:
Code:
<html><head>

</head><body>
<form action="validate.asp" method="POST" name="registrationFrm">
<input type="hidden" name="gstrSurveyId" value="374">
<input type="hidden" name="frmPostalCode" value="G4G4G4">
<input type="hidden" name="frmEmail" value="asdfhdfgh@wdfsdf.com">
<input type="hidden" name="frmLastName" value="asdfsadf">
<input type="hidden" name="frmLanguage" value="english">
<input type="hidden" name="frmCommunication" value="email">
							<p align="center">
								&nbsp;<p align="center">
								Your information has been validated, please click 
								the button below to begin the survey.<p align="center">
								<input type="submit" value="Submit" />


</form>


<script type="text/javascript">
<!--//
document.registrationFrm.submit();
//-->
</script>
</body>

</html>

//// could this be a server permission issue or something with the Windows server?
 
It works fine on my computer locally. What page is in the address bar when you get the error message? Is it a Javascript error message, or an ASP error message?

Lee
 
firefox says twice:

Error: document.registrationFrm.submit is not a function
Source File: Line: 34


The above file is an asp include into mda_determine2.asp, in which i have a simple asp: if this then situation; the else is the code above, i have even tried to directly add this code to the page with out affect. It does redirect to the correct page but i have to press the submit button to post the hidden form values, wishing it was called automatically? any suggestions?
<!-include......
 
I am not impressed to see script section dispersed all over, in particularly outside html. Put it in head section.
[tt]
<html><head>
<script type="text/javascript">
function setFocus(){
document.registrationFrm.submit();
}
window.onload = setFocus;
</script>
</head><body>
<form action="validate.asp" method="POST" name="registrationFrm">
<input type="hidden" name="gstrSurveyId" value="374" />
<input type="hidden" name="frmPostalCode" value="G4G4G4" />
<input type="hidden" name="frmEmail" value="asdfhdfgh@wdfsdf.com" />
<input type="hidden" name="frmLastName" value="asdfsadf" />
<input type="hidden" name="frmLanguage" value="english" />
<input type="hidden" name="frmCommunication" value="email" />
<p align="center">
&nbsp;<p align="center">
Your information has been validated, please click
the button below to begin the survey.<p align="center">
<input type="submit" value="Submit" />


</form>
</body>
</html>
[/tt]
 
It is a ssi? How is it actually scripted? No need to doubt the above script. It is a working thing. Look at the real thing which causes error and stop imagining. Ask there, the asp forum, for detail advice on ssi and I would recommend do it there.
 
no its not a ssi, its embedded directly into the html. I as using an If this = 4 then
display this html else display this html

If i put a counter in JS function and tied it to form.submit() do you think it would make a difference?
 
Unless there are subtle twists, it should do switching the whole content html-tag down. Whether it is a good practice of not, it is up to individual's opinion.
[tt]
<%
dim n
n=4
if n=4 then %>
<html><head>
<script type="text/javascript">
function setFocus(){
document.registrationFrm.submit();
}
window.onload = setFocus;
</script>
</head><body>
<form action="validate.asp" method="POST" name="registrationFrm">
<input type="hidden" name="gstrSurveyId" value="374" />
<input type="hidden" name="frmPostalCode" value="G4G4G4" />
<input type="hidden" name="frmEmail" value="asdfhdfgh@wdfsdf.com" />
<input type="hidden" name="frmLastName" value="asdfsadf" />
<input type="hidden" name="frmLanguage" value="english" />
<input type="hidden" name="frmCommunication" value="email" />
<p align="center">&nbsp;
<p align="center">Your information has been validated, please click the button below to begin the survey.
<p align="center">
<input type="submit" value="Submit" />
</form>
</body>
</html>
<% else %>
<html><head>
<script type="text/javascript">
function setFocus(){
document.registrationFrm.submit();
}
window.onload = setFocus;
</script>
</head><body>
<form action="validate.asp" method="POST" name="registrationFrm">
<input type="hidden" name="gstrSurveyId" value=" />
<input type="hidden" name="frmPostalCode" value=" />
<input type="hidden" name="frmEmail" value=" />
<input type="hidden" name="frmLastName" value=" />
<input type="hidden" name="frmLanguage" value=" />
<input type="hidden" name="frmCommunication" value=" />
<p align="center">&nbsp;
<p align="center">Your information has been validated, please click the button below to begin the survey.
<p align="center">
<input type="submit" value="Submit" />
</form>
</body>
</html>
<% end if %>
[/tt]
Switch around n=4 or n equal to something else, does it not work for you?
 
Try it accessing the form through the associative array:
Code:
document.forms['registrationFrm'].submit();

Lee
 
tsuji, that works... but i have 3 if then Elses and the final else case stands for over 300 situations, think of it like countries, i have if canada then
Elseif usa then
Elseif mexico then
Else if any other country in the world then

hence i need the else to be how it is.
/////////////
trollacious,

I tried that and within a function as well,

There seems to be a timing issue on the ASP versus the JS code, maybe i need to slow down the JS code cause the server may be slow? any suggestions?
Thanks everyone!
 
i tried setTimeinterval and still no luck, i even tried to call the setTimeinterval which calls the submit function from the <body onload and still no luck.


would being under a ssl on a window box have something to do with it?
 
>tsuji, that works... but i have 3 if then Elses and the final else case stands for over 300 situations, think of it like countries, i have if canada then
Elseif usa then
Elseif mexico then
Else if any other country in the world then


If it works on 2 elseif's, it works with any number of elseif! I have seen you alter the script section to without onload etc etc or different alternative. But that is random shooting. That's why I said
>[self]Look at the real thing which causes error and stop imagining
maybe you take it very badly. But that's a hard fact! Altering document.formname.submit() to document.forms[formname].submit() etc are all in an equivalent class which will not change anything in this situation---not that I say it won't serve a purpose, but not here. setTimeout() etc is not essential to here neither.

For many choices, you know you can use "select case" to change the page to serve instead of if elseif... that simplifies the flow of logic of the script.

 
select case does not work, also removed the includes and still no luck. so the includes are throwing it off, nor was the else ifs, and the asp validate until the else ifs casue they trigger under their correct condition.
 
If each case's html/asp page works, it is impossible this not working. I'm talking about atomic fact. Its truth is beyond working or not working in your particular design that we don't see. You might like it or not like it, but it is not up here or anywhere for negotiation!
[tt]
<%
dim n
n=4 'change around to show
select case n
case 4
%>
[blue]<html>
//etc etc your whole page for case n=4
</html>[/blue]
<%
case 5
%>
[blue]<html>
//etc etc your whole page for case n=5
</html>[/blue]
<%
'etc etc for different identifiable cases
'case else
%>
[blue]<html>
//etc etc your whole page for case outside those identified
</html>[/blue]
<%
end select
%>
[/tt]
After, you may simply the thing with ssi. Must narrow down the cause to get thing done.
 
Look at onressy's post in the ASP forum. It's the same problem, with slightly different code, and I've posted a solution to the latest code (s)he provided.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top