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

how to submit a form without pressing a submit button in vbscript <%%> 1

Status
Not open for further replies.

dklovedoctor

Programmer
Oct 6, 2002
5
GR
i'd like to know how one can submit a form in vbscript (<%,%>)
without pressing the submit key

or

how to send variables from one page to another through vbscript and without pressing any buttons

thanx alot
 
did you try
Code:
response.redirect(&quot;targetPage.asp&quot;)
? Water is not bad as soon as it stays out human body ;-)
 
i've tried it up
and the form is not submitted with the redirect

thanx anyway

but still i got a problem :)
 
so did you try this :
Code:
<Script language=&quot;VBScript&quot;>
function subForm()
  myform.submit
end function
</script>
Where &quot;myform&quot; is the name of the form to submit. The problem is &quot;Where to call this function ?&quot; Water is not bad as soon as it stays out human body ;-)
 
how do i call the check() function inside the <% code %>


<SCRIPT LANGUAGE=VBSCRIPT>
<!--
function check()
Dim TheForm
Set TheForm=Document.form
IF TheForm.password1.value<>TheForm.password2.value THEN
TheForm.error.value=&quot;Please Check your Passwords , they do not match&quot;
TheForm.action=&quot;newUser.asp&quot;
THeForm.submit()
ELSE IF TheForm.password1.value=&quot;&quot; THEN
TheForm.error.value=&quot;Please fill in the password fields, they are required&quot;
TheForm.action=&quot;newUser.asp&quot;
TheForm.submit()
ELSE IF TheForm.login.value=&quot;&quot; THEN
TheForm.error.value=&quot;Please fill in the login field, it is required&quot;
TheForm.action=&quot;newUser.asp&quot;
THeForm.submit()
END IF
END IF
END IF
end function
-->
</SCRIPT>

<%

Dim rs
Dim strConn

Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
strConn = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\
rs.Open &quot;Users&quot;, strConn
Do While Not rs.EOF
IF rs.Fields(&quot;userName&quot;)=Request.form(&quot;login&quot;) THEN
Response.redirect(&quot;newUser.asp&quot;)
END IF
rs.MoveNext
Loop

rs.Close
Set rs = Nothing

%>
 
You can't call directly a client side function in your asp tags 'cause their content runs server side. But if you want to submit the calling of your check function to a test in ASP, what you can do is the following :
is your ASP (<% %>) make a test to check either you want to run your check function or not and then call it in the onload event of your form like this :
Code:
<%
...
dim onloadCall
if mycondition then
  onloadCall = &quot;check()&quot;
else
  onloadCall = &quot;&quot;
end if
...
%>

<body onload=&quot;<%=onloadCall%>&quot;>
[/body]
 Water is not bad as soon as it stays out human body ;-)
 
Do you want to be my lawyer Patrician ???
You are so king to defend my interests ;-) Water is not bad as soon as it stays out human body ;-)
 
If a reply helps, a good way to show appreciation of it is to award a star. Its just a matter of being courteous to someone who has helped.

:eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top