...

View Full Version : why JS in asp not working



havey
04-19-2006, 06:45 AM
there's some code the JS in the ASP Else case which does not initstantiate the form to post, the page displays under the right condition but no js working. The code in the else case works if i cut and paste into a new browser. Does not seem to work in this asp situation, any ideas how?




<%
If gstrProfessionId = "4" Then
%>
<!--#include file="registrationContinued2.asp"-->
<%
ElseIf gstrProfessionId = "11" Then
%>
<!--#include file="registrationindustry2.asp"-->
<%
ElseIf gstrProfessionId = "1" Then
%>
<!--#include file="registrationnurse2.asp"-->
<%
ElseIf gstrProfessionId = "3" Then
%>
<!--#include file="registrationpharamist2.asp"-->
<%
Else
' also tried code below as an include like above without any luck
%>

<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">
<%
For Each thing In Request.Form
Response.Write "<input type=""hidden"" name=""" & thing & """ value=""" & Request.Form(thing) & """>" & vbCrLf
Next
%>
<p align="center"> <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
%>

degsy
04-19-2006, 02:57 PM
What error are you getting?

havey
04-20-2006, 12:38 AM
the js error is object does not support this property of method and points to this line:

document.forms['registrationFrm'].submit();


I have even tried using a setTimeInterval and when the time runs out i get the same error:

</form>
<script>
window.onload = function(){
setTimeout("damnDelay()", 3000); //2 secs
}

function damnDelay() {
document.forms['registrationFrm'].submit();
}
</script>


//could this be happening becasue i'm under a SSL ?

degsy
04-25-2006, 03:57 PM
Add a name to your button. Note the Uppercase S


<input type="submit" name="Submit" value="Submit" />



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum