Performance Question...

A

Aaron

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.location.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?
 
A

Aaron Bertrand - MVP

You can leave out the action altogether, and save the hassle of figuring out
the URL. A form without an action submits to itself...
 
R

Ray at

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
 
A

Aaron Bertrand - MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,138
Messages
2,570,798
Members
47,347
Latest member
RebekahStu

Latest Threads

Top