470,613 Members | 2,186 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

Performance Question...

hello. i have the following in a form that submits to itself ...

<%
dim page, strurl, strurldesc
page = trim(request.servervariables("script_name"))
strurl = trim(request.form("strurl"))
strurldesc = trim(request.form("strurldesc"))

if request.totalbytes > 0 then
savelink strurl, session("uid"), strurldesc
%>
<script>
window.opener.navigate(window.opener.document.loca tion.href);
window.close();
</script>
<%
end if
%>

<form name="Form" action="<%=page%>" method="post">
<snip />
</form>

Is this 'alright', or is there a better method for submitting the form
to itself?

Jul 19 '05 #1
3 1373
You can leave out the action altogether, and save the hassle of figuring out
the URL. A form without an action submits to itself...

"Aaron" <a@1.net> wrote in message
news:uW*************@TK2MSFTNGP10.phx.gbl...
hello. i have the following in a form that submits to itself ...

<%
dim page, strurl, strurldesc
page = trim(request.servervariables("script_name"))
strurl = trim(request.form("strurl"))
strurldesc = trim(request.form("strurldesc"))

if request.totalbytes > 0 then
savelink strurl, session("uid"), strurldesc
%>
<script>
window.opener.navigate(window.opener.document.loca tion.href);
window.close();
</script>
<%
end if
%>

<form name="Form" action="<%=page%>" method="post">
<snip />
</form>

Is this 'alright', or is there a better method for submitting the form
to itself?

Jul 19 '05 #2
Just be aware of what happens if you're on the directory's default page when
you do this, ie. http://yoursite.com/ If there's no pagename in the url,
you'll get a 405 when you post.

Ray at work

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl...
You can leave out the action altogether, and save the hassle of figuring out the URL. A form without an action submits to itself...

"Aaron" <a@1.net> wrote in message
news:uW*************@TK2MSFTNGP10.phx.gbl...
hello. i have the following in a form that submits to itself ...

<%
dim page, strurl, strurldesc
page = trim(request.servervariables("script_name"))
strurl = trim(request.form("strurl"))
strurldesc = trim(request.form("strurldesc"))

if request.totalbytes > 0 then
savelink strurl, session("uid"), strurldesc
%>

Jul 19 '05 #3
> Just be aware of what happens if you're on the directory's default page
when
you do this, ie. http://yoursite.com/ If there's no pagename in the url,
you'll get a 405 when you post.


True, if you know your form is on the default page, you can just hardcode /
or even http://yoursite.com/ ... still without having to futz with all that
servervariable parsing.

A
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

115 posts views Thread by Mark Shelor | last post: by
4 posts views Thread by Martin | last post: by
13 posts views Thread by bjarne | last post: by
6 posts views Thread by Mike | last post: by
18 posts views Thread by Rune B | last post: by
5 posts views Thread by Varangian | last post: by
30 posts views Thread by galiorenye | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.