Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Execute a SUB on click of Submit


Message #1 by "bindiya" <bindiya@d...> on Tue, 21 May 2002 11:37:55 -0700
This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C200BB.F2C0C840
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear sir

I have a small  Problem in the form action if i give html page it open 
but if i want it to go to a Sub on form action (submit button) click and 
execute then  how to do it i tried it it gave me Mime error  . I thing 
my format is wrong . i want to call  SUB -subdata

Please Help 


HTTP Error 405
405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource 
identified by the request. Please ensure that you have the proper MIME 
type set up for the resource you are requesting.

Please contact the server's administrator if this problem persists.

<%

Dim strDBConn,strDBConn1,intLog, strLogURL, strAdminName, strAdminPass

strDBConn =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data 
Source=3Dc:\Inetpub\wwwroot\aspcc15\clients.mdb;"

 strDBConn1 =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data 
Source=3Dc:\Inetpub\wwwroot\aspcc15\datastore.mdb;"

 'Set intLog to "1" if you want to keep a log of attempts to enter.

 intLog =3D 1

strLogURL =3D "c:\Inetpub\wwwroot\aspcc15\cclog.txt"

 strAdminName =3D "Jim" strAdminPass =3D "Miles" 
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D 'Your custom subroutine 
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D 

Sub subCustomCode

 Response.Write "<p><b>" & Request("Username") & "</b>, please enjoy 
your stay!<p>"
 Response.Write "<i>Your custom function is executed at this point.</i>"
 Response.write "<body>"
 Response.Write "<br><center>"
 'Response.Write "<FORM action=3DC:\Inetpub\wwwroot\aspcc15\temp.htm 
method=3Dpost id=3Dform1 name=3Dform1>"  Response.Write "<FORM 
action=3Dsubdata method=3Dpost id=3Dform1 name=3Dform1>"    'ERROR'
 Response.Write "<table border=3D1 ><TR><TD><b> Welcome "
 Response.Write "</b></TD><TD><b> ClasifiedAdvertisement</b></TD></TR>"
 Response.Write "<TR><TD><b> Select Type of Avertisement</b></TD>"
 Response.Write "<TD>  <SELECT id=3Dselect1 name=3Dselect1> "
 Response.Write "<OPTION selected value =3D0>Matrimonial</OPTION>"
 Response.Write "<OPTION  value =3D1>Situation Vacant</OPTION>"
 Response.Write "<OPTION  value =3D2>MotorCycle</OPTION><OPTION  value 
=3D3>Tours & Travel</OPTION>"
 Response.Write "<OPTION  value =3D4>Medical</OPTION>"
 Response.Write "<OPTION  value =3D5>Misc For Sale</OPTION>"
 Response.Write "<OPTION  value =3D6>Misc Wanted</OPTION>"
 Response.Write "<OPTION  value =3D7>Pets & LiveStock</OPTION>"
 Response.Write "<OPTION  value =3D8>Plants and Seedling </OPTION>"
 Response.Write "</SELECT> </TD></TR><tr><td><b>Size of 
Advertisement</b> </td>"
 Response.write"<td><SELECT id=3Dselect2 name=3Dselect2>"
 Response.Write " <OPTION selected value =3D0>1*1</OPTION>"
 Response.Write "<OPTION  value =3D1>2*2</OPTION>"
 Response.Write "</SELECT></td></tr> <tr><td><b>Company Profile</b> 
</td>"
 Response.Write "<td> <INPUT id=3Dtext1 name=3Dtext1></td></tr> "
 Response.Write "<tr><td>Title  </td><td>"
 Response.Write " <INPUT id=3Dtext1 name=3Dtext1></td></tr>"
 Response.Write "<tr><td>Qualification  </td><td> "
 Response.Write "<INPUT id=3Dtext1 name=3Dtext1></td></tr>"
 Response.Write " <tr><td>Requirements   </td><td>"
 Response.Write " <INPUT id=3Dtext1 name=3Dtext1></td></tr> "
 Response.Write " <tr><td>Contact Information    </td>"
 Response.Write "<td> <INPUT id=3Dtext1 name=3Dtext1></td></tr>"
 Response.Write "<tr><td></td>"'<INPUT id=3Dbutton1 name=3Dbutton1 
type=3Dbutton value=3DReset></td>"
 Response.Write "<td>"'<INPUT id=3Dbutton1 name=3Dbutton1 type=3Dbutton 
value=3DSubmit ></td>"
 Response.Write "<INPUT id=3Dsubmit1 name=3Dsubmit1 type=3Dsubmit 
value=3DSubmit></td>"
 Response.Write "</tr></table></center><body>"
 'Response.Write "<script language =3Djavascript>"
 'Response.Write "window.open('temp.htm')"
 'Response.Write "</script>"

End Sub
%>


<%
sub subdata
Response.Write "hwlloooooo"
end sub


%>




Message #2 by xywu@k... on Wed, 22 May 2002 17:44:34 +0800 (CST)
i think you have made a mistake.
all word in "<%" and  "%>" will be executed at server.
if you want to excute a function or sub before submit ,you can catch the event of "onsubmit", and the sub or function must be
executed at client.
like this
<form name=form1 method='post' onsubmit='return SubOfTest();'>
<input type=text name=text><input type=submit name=submit value='submit'>
</form>
<script>
    function SubOfTest(){
     if( window.confirm('are you sure to submit?')){
      alert('i will submit now');return true;    }
     else{
      alert('i will not submit');return false;      }
}
</script>




> 
> Dear sir 
>  
> I have a small  Problem in the form action if 
> i give html page it open but if i want it to go to a Sub on form action (submit 
> button) click and execute then  how to do it i tried it it gave me Mime 
> error  . I thing my format is wrong . i want to call  SUB 
> -subdata
>  
> Please Help  
>  
> HTTP Error 405
> 405 Method Not Allowed
> The method specified in the Request Line is not allowed for the resource 
> identified by the request. Please ensure that you have the proper MIME type set 
> up for the resource you are requesting.
> Please contact the server's administrator if this problem persists.
> <%======================================================================
> 'Your custom subroutine
> '======================================================================================================
> 'Please test the script with this default subroutine prior to modifying it. 
> 'The code contained in this subroutine will execute when your clients login successfully.
> 'Alter only the code within the "Sub" and "End Sub" delimiters.
> Sub subCustomCode 
> 
> 	Response.Write ""   Request("Username")   ", please enjoy your stay!"
> 	Response.Write "Your custom function is executed at this point."
> 	Response.write ""
> 	Response.Write ""
> 	'Response.Write ""
> 	Response.Write ""
> 	Response.Write " Welcome "
> 	Response.Write " ClasifiedAdvertisement"
> 	Response.Write " Select Type of Avertisement"
> 	Response.Write "   "
> 	Response.Write "Matrimonial"
> 	Response.Write "Situation Vacant"
> 	Response.Write "MotorCycleTours   Travel"
> 	Response.Write "Medical"
> 	Response.Write "Misc For Sale"
> 	Response.Write "Misc Wanted"
> 	Response.Write "Pets   LiveStock"
> 	Response.Write "Plants and Seedling "
> 	Response.Write " Size of Advertisement "
> 	Response.write""
> 	Response.Write " 1*1"
> 	Response.Write "2*2"
> 	Response.Write " Company Profile "
> 	Response.Write "  "
> 	Response.Write "Title?"
> 	Response.Write " "
> 	Response.Write "Qualification? "
> 	Response.Write ""
> 	Response.Write " Requirements ?"
> 	Response.Write "  "
> 	Response.Write " Contact Information  ?"
> 	Response.Write " "
> 	Response.Write ""'"
> 	Response.Write ""'"
> 	Response.Write ""
> 	Response.Write ""
> 	'Response.Write ""
> 	
> End Sub
> %>
> Dim strDBConn,strDBConn1,intLog, strLogURL, strAdminName, strAdminPass 
> strDBConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
> Source=c:\Inetpub\wwwroot\aspcc15\clients.mdb;"
>  strDBConn1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
> Source=c:\Inetpub\wwwroot\aspcc15\datastore.mdb;"
>  'Set intLog to "1" if you want to keep a log of attempts to enter.
>  intLog = 1
> strLogURL = "c:\Inetpub\wwwroot\aspcc15\cclog.txt" 
>  strAdminName = "Jim" strAdminPass = "Miles" 
> '====================================================================================================== 
> 'Your custom subroutine 
> '======================================================================================================
======================================================================
> 'Your custom subroutine
> '======================================================================================================
> 'Please test the script with this default subroutine prior to modifying it. 
> 'The code contained in this subroutine will execute when your clients login successfully.
> 'Alter only the code within the "Sub" and "End Sub" delimiters.
> Sub subCustomCode 
> 
> 	Response.Write ""   Request("Username")   ", please enjoy your stay!"
> 	Response.Write "Your custom function is executed at this point."
> 	Response.write ""
> 	Response.Write ""
> 	'Response.Write ""
> 	Response.Write ""
> 	Response.Write " Welcome "
> 	Response.Write " ClasifiedAdvertisement"
> 	Response.Write " Select Type of Avertisement"
> 	Response.Write "   "
> 	Response.Write "Matrimonial"
> 	Response.Write "Situation Vacant"
> 	Response.Write "MotorCycleTours   Travel"
> 	Response.Write "Medical"
> 	Response.Write "Misc For Sale"
> 	Response.Write "Misc Wanted"
> 	Response.Write "Pets   LiveStock"
> 	Response.Write "Plants and Seedling "
> 	Response.Write " Size of Advertisement "
> 	Response.write""
> 	Response.Write " 1*1"
> 	Response.Write "2*2"
> 	Response.Write " Company Profile "
> 	Response.Write "  "
> 	Response.Write "Title?"
> 	Response.Write " "
> 	Response.Write "Qualification? "
> 	Response.Write ""
> 	Response.Write " Requirements ?"
> 	Response.Write "  "
> 	Response.Write " Contact Information  ?"
> 	Response.Write " "
> 	Response.Write ""'"
> 	Response.Write ""'"
> 	Response.Write ""
> 	Response.Write ""
> 	'Response.Write ""
> 	
> End Sub
> %> 
> Sub subCustomCode 
>  Response.Write "<p><b>" & 
> Request("Username") & "</b>, please enjoy your 
> stay!<p>" Response.Write "<i>Your custom function is 
> executed at this point.</i>" Response.write 
> "<body>" Response.Write 
> "<br><center>" 'Response.Write "<FORM 
> action=C:\Inetpub\wwwroot\aspcc15\temp.htm method=post id=form1 
> name=form1>"  Response.Write "<FORM 
> action=subdata method=post id=form1 name=form1>"    'ERROR' Response.Write "<table 
> border=1 ><TR><TD><b> Welcome " Response.Write 
> "</b></TD><TD><b> 
> ClasifiedAdvertisement</b></TD></TR>" Response.Write 
> "<TR><TD><b> Select Type of 
> Avertisement</b></TD>" Response.Write "<TD>  
> <SELECT id=select1 name=select1> " Response.Write "<OPTION 
> selected value =0>Matrimonial</OPTION>" Response.Write 
> "<OPTION  value =1>Situation 
> Vacant</OPTION>" Response.Write "<OPTION  value 
> =2>MotorCycle</OPTION><OPTION  value =3>Tours & 
> Travel</OPTION>" Response.Write "<OPTION  value 
> =4>Medical</OPTION>" Response.Write "<OPTION  value 
> =5>Misc For Sale</OPTION>" Response.Write "<OPTION  
> value =6>Misc Wanted</OPTION>" Response.Write 
> "<OPTION  value =7>Pets & 
> LiveStock</OPTION>" Response.Write "<OPTION  value 
> =8>Plants and Seedling </OPTION>" Response.Write 
> "</SELECT> </TD></TR><tr><td><b>Size of 
> Advertisement</b> 
> </td>" Response.write"<td><SELECT id=select2 
> name=select2>" Response.Write " <OPTION selected value 
> =0>1*1</OPTION>" Response.Write "<OPTION  value 
> =1>2*2</OPTION>" Response.Write 
> "</SELECT></td></tr> <tr><td><b>Company 
> Profile</b> </td>" Response.Write "<td> <INPUT 
> id=text1 name=text1></td></tr> " Response.Write 
> "<tr><td>Title  </td><td>" Response.Write 
> " <INPUT id=text1 
> name=text1></td></tr>" Response.Write 
> "<tr><td>Qualification  </td><td> 
> " Response.Write "<INPUT id=text1 
> name=text1></td></tr>" Response.Write " 
> <tr><td>Requirements   
> </td><td>" Response.Write " <INPUT id=text1 
> name=text1></td></tr> " Response.Write " 
> <tr><td>Contact Information    
> </td>" Response.Write "<td> <INPUT id=text1 
> name=text1></td></tr>" Response.Write 
> "<tr><td></td>"'<INPUT id=button1 name=button1 type=button 
> value=Reset></td>" Response.Write "<td>"'<INPUT 
> id=button1 name=button1 type=button value=Submit 
> ></td>" Response.Write "<INPUT id=submit1 name=submit1 
> type=submit value=Submit></td>" Response.Write 
> "</tr></table></center><body>" 'Response.Write 
> "<script language =javascript>" 'Response.Write 
> "window.open('temp.htm')" 'Response.Write 
> "</script>" End Sub%>
> <%sub subdataResponse.Write 
> "hwlloooooo"end sub
> %>
> ---
> 
> 
> 
>  
----------------------------------------------
»¶Ó­Ê¹Óà km169mail µç×ÓÓʼ
ϵͳ http://email.km169.net
Thank you for useing km169mail Email system


  Return to Index