Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 24th, 2004, 04:37 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Two Client Side vs Server Side issues

Hi,
I was wondering how to do this server side:
submit a form collection with a response.redirect or something similar. I would like to have a link to a page is never seen, but fills form inputs with URL variables, then submits the form to the next page. Is this possible to do on the server side?

Secondly, are there pro's and con's to using a javascript window.location as opposed to a response.redirect() other than the fact that the javascript example could fail on the client side? I was wondering why anyone would use a javascript redirect in the case that it is possible to use a server side redirect.

Thanks,

Milo

Reply With Quote
  #2 (permalink)  
Old May 24th, 2004, 05:37 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

JavaScript redirection with window.location is not preferred, as it adds another item in the history list. So, when you press back, nothing happens.

Instead, redirect on the server, redirect with the <meta> tag, or redirect with JavaScript using location.replace(), as it does not add another item in the history.

Example:

window.location='page2.asp'; //adds to the history, killing the back button
location.replace('page2.asp'); //history says you've never visited page1.asp so when you click back it takes you to the page before

HTH,

Snib

<><
Reply With Quote
  #3 (permalink)  
Old May 24th, 2004, 05:42 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

As for your first question, you can fill in form element values with ASP or a client-side language (JavaScript). JavaScript can submit it. So you wanted something like this?

<form method=post action=readform.asp id=f>
<input type=hidden id=element1>
<input type=hidden id=location>
</form>

<script type=text/javascript language=javascript>
document.forms.f.element1.value = 'value!';
document.forms.f.location.value = window.location;
document.forms.f.submit();
</script>

Let me know if this helps,

Snib

<><
Reply With Quote
  #4 (permalink)  
Old May 25th, 2004, 09:14 AM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the replies Snib. For the form submission, I was wondering if there is any way to do exactly that on the server side as opposed to the client side.

Again, I would like to remove all possibility of the user screwing this up (by not having JS enabled, etc.)

Thanks!

Reply With Quote
  #5 (permalink)  
Old May 25th, 2004, 09:47 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I think you need to clarify a bit. You want JavaScript to pass variables to ASP? This is the only way I know of doing this. If you just wanted values like the location, I believe you can get that straight from ASP.

Also, you can detect if the user has disabled JavaScript. Just make a <div> or a <span> that says, "Please enable JavaScript to continue." and then onload call a JavaScript function that changes the content of the <span> or <div> to "JavaScript is enabled." If JavaScript is enabled, the function will be called to change the message. Otherwise the content will remain the warning message.

Please let me know if this helps you, or if this is off track.

HTH,

Snib

<><
Reply With Quote
  #6 (permalink)  
Old May 25th, 2004, 02:47 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I guess that it is not the end of the world if i have to do something like:
document.forms.f.field.value = 'value!';
document.forms.f.submit();

blah...blah..please hit continue.
<form action="page2.asp" method="post" name="f" id="f">
  <input type="hidden" name="field" value="<%=Request.QueryString("v")%>">
  <input type="submit" value="Continue">
</form>

This way if javascript is disabled all they have to do is hit the continue button, but i would like to find a server script that would submit a form, or post data to a page that would mimick form data.

Does that make any sense?

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Converting Client-side to Server-side Code kwilliams ASP.NET 2.0 Professional 1 November 21st, 2007 05:25 PM
Firing server side events at client side codes mehdi62b ASP.NET 1.0 and 1.1 Basics 6 May 18th, 2005 09:11 AM
sharing a server-side variable with client-side pigtail Javascript How-To 6 November 4th, 2004 02:01 AM
Client & Server Side Scripting Problem lbob Classic ASP Professional 0 October 16th, 2003 10:45 AM
Accessing Server Side Data on Client Side steve456 Classic ASP Professional 3 October 15th, 2003 02:33 PM



All times are GMT -4. The time now is 04:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.