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

Post Method 1

Status
Not open for further replies.

ecannizzo

Programmer
Sep 19, 2000
213
US
I need to send info to a site through the post method. I would normally do this through a form's submit button, but first I want to validate some info and then send it on to this other site. Is there any way for me to do this, still using the post method to get this info to the other site?

Thanks!
Erica Erica
 
yup you can do this with javascript

for example:

<html>
<script>
function check()
{
if (document.test.help.value =>9)
alert(&quot;help is more than 9 character)
return;
}
</script>

<body>

<form test>
<input type=text name=help onClick=check()>
<input type=submit>
</form>
</body>
</html>

 
I also want to set this information into session variables. Can I do that with Javascript?
 
hello

a few things i forgot
<form name=test action=<whatever page> method=post>

onClick='check() return false'

for the function
function check()
{

if document.test.help.value =>9
alert(&quot;value of help is more than and equal to 9&quot;)

// not more 9 character use .length for that.
return false;
else
return true;
}

Or you can use combination of ASP and javascript to do it another way...

pass the information to ASP and have asp check it return back with a Session(&quot;Error&quot;), if error is 0 then pass it to the new form using Onload
 
I find the last part of your statement interesting. But what do you mean by pass it to a new form using Onload?

Thanks!
Erica
 
Session variable yes you can

->help.asp<-
<html>
<body>

<%if(NOT Session(&quot;Error&quot;) = &quot;&quot;) then
Response.Write(Session(&quot;Error&quot;))
end if %>

<form name=test action='test.asp' method=post>
<input type=text name=help>
<input type=submit>
</form>
</body>
</html>

->test.asp<-
<%
help = Request.Form(&quot;help&quot;)

if (help = &quot;&quot;) then
Session(&quot;Error&quot;) = &quot;You have to input something for help&quot;
Response.Redirect(&quot;help.asp&quot;)
else
Session(&quot;FieldHelp&quot;) = help
Response.Redirect(&quot;submit.asp&quot;)
end if
%>
->submit.asp

<html>
<script>
function submitnow() {
document.submitnow.help.value = <%=Session(&quot;FieldHelp&quot;)%>;
document.submitnow.submit;
}
</script>

<body onload=submitnow()>
<form name=submitnow action=&quot;suppose to be submitted to?&quot; method=post>
<input type=hidden name=help>
</form>
</body>
</html>

hehe, might have some typo, did this in like 1 or 2 mintues..

hui
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top