Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread Harry Zhu

Looks like my explanation is too long or too bad.
The simple idea is in page step 1, after the

form action=/step/2 method=post.../form

submitted, I want the browser show something
http://www.example.com/step/1/error, instead of
http://www.example.com/step/2,
if there is a need for user to correct the data submitted.

It might be accomplished by using one of the approaches outlined below, but
I was wondering if there's other way that can save the overhead of the
write/read or resend the data, and the re-process. Probably not much we can
do if the URL displayed in the browser's address/location bar depends only
on the action value of the form submitted, not based on the server response?

Harry



- Original Message -
From: Harry Zhu [EMAIL PROTECTED]
To: mod_perl list [EMAIL PROTECTED]
Sent: Thursday, August 08, 2002 4:22 PM
Subject: Can I change the browser's address/location?


 Suppose I have a generic content handler to handle requst
 /step/1, /step/2, ..., /step/n

 Location /step
   SetHandler perl-script
   PerlHandler MyHandler

 /Location

 #MyHandler.pm
 package MyHandler;
 sub handler {
   my $r=shift;
   my $step = substr($r-path_info(),1);

   #do something before fetch the content

   #fetch content: usually include a form that will assign action
 /step/($step+1)

 }

 So if everything goes well, the user will follow through from step 1, step
 2, until fnish.
 Now if in the #do something ... part, something is wrong, it will
usually
 require user go back to the same step, for example, to fill the form
again.
 The way my old cgi script does is just generate the form with prefilled
 value plus some error message indicate what's wrong. It works ok but the
 browser location will show /step/($step+1) while it actually is
/step/$step.
 Now that I am working it on mod-perl I thought I should be able to do
 something about it. I briefly browsed the 2 mod-perl books (eagle,
 cookbook), and could not found a simple solution yet  (or I missed it?). I
 was think using one of the folowing might work:z
 1) save the request data in a temp file and redirect or http-refresh to
 /step/$step?$session_id or /step/$step/error?$session_id
 Remember the content is dynamic and depend on the input form data, so
simple
 redirect may not work.
 Looks like Apache will not post the form data when redirect with Location?

 2) print a short form with hidden data and assign action=/step/$step/error
 then submit right away (onload=form.submit()?)

 Does anybody have a simple solution, e.g. without redirect? Is it possible
 to change the URI showing in the browser's address/location bar?

 I would appreciated if somebody can pointer me to the right direction.

 Harry







RE: Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread French, Shawn

One option:

If there's an erro in form 2,
Save the user's form data in some session variables
Then use a META HTTP-EQUIV=Refresh CONTENT=0; URL=/step2 tag to get the
user's browser to redirect.
Then populate the form with the data and error message you saved in his/her
session object.

There are obviously many other ways to do this... but if you're using some
sort of session data structure, this is probably the easiest way to get it
done.

Shawn



 -Original Message-
 From: Harry Zhu [mailto:[EMAIL PROTECTED]]
 Sent: August 9, 2002 2:26 PM
 To: [EMAIL PROTECTED]
 Subject: Is it possible to change the browser's address/location URL
 without Redirect?
 
 
 Looks like my explanation is too long or too bad.
 The simple idea is in page step 1, after the
 
 form action=/step/2 method=post.../form
 
 submitted, I want the browser show something
 http://www.example.com/step/1/error, instead of
 http://www.example.com/step/2,
 if there is a need for user to correct the data submitted.
 
 It might be accomplished by using one of the approaches 
 outlined below, but
 I was wondering if there's other way that can save the overhead of the
 write/read or resend the data, and the re-process. Probably 
 not much we can
 do if the URL displayed in the browser's address/location bar 
 depends only
 on the action value of the form submitted, not based on the 
 server response?
 
 Harry
 
 
 
 - Original Message -
 From: Harry Zhu [EMAIL PROTECTED]
 To: mod_perl list [EMAIL PROTECTED]
 Sent: Thursday, August 08, 2002 4:22 PM
 Subject: Can I change the browser's address/location?
 
 
  Suppose I have a generic content handler to handle requst
  /step/1, /step/2, ..., /step/n
 
  Location /step
SetHandler perl-script
PerlHandler MyHandler
 
  /Location
 
  #MyHandler.pm
  package MyHandler;
  sub handler {
my $r=shift;
my $step = substr($r-path_info(),1);
 
#do something before fetch the content
 
#fetch content: usually include a form that will assign action
  /step/($step+1)
 
  }
 
  So if everything goes well, the user will follow through 
 from step 1, step
  2, until fnish.
  Now if in the #do something ... part, something is wrong, it will
 usually
  require user go back to the same step, for example, to fill the form
 again.
  The way my old cgi script does is just generate the form 
 with prefilled
  value plus some error message indicate what's wrong. It 
 works ok but the
  browser location will show /step/($step+1) while it actually is
 /step/$step.
  Now that I am working it on mod-perl I thought I should be 
 able to do
  something about it. I briefly browsed the 2 mod-perl books (eagle,
  cookbook), and could not found a simple solution yet  (or I 
 missed it?). I
  was think using one of the folowing might work:z
  1) save the request data in a temp file and redirect or 
 http-refresh to
  /step/$step?$session_id or /step/$step/error?$session_id
  Remember the content is dynamic and depend on the input 
 form data, so
 simple
  redirect may not work.
  Looks like Apache will not post the form data when redirect 
 with Location?
 
  2) print a short form with hidden data and assign 
 action=/step/$step/error
  then submit right away (onload=form.submit()?)
 
  Does anybody have a simple solution, e.g. without redirect? 
 Is it possible
  to change the URI showing in the browser's address/location bar?
 
  I would appreciated if somebody can pointer me to the right 
 direction.
 
  Harry
 
 
 
 



Re: Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread Harry Zhu

That what's the approach outlined in 1). I was wondering if that network
trip can be avoided.

Thanks,
Harry

- Original Message -
From: French, Shawn [EMAIL PROTECTED]
To: 'Harry Zhu' [EMAIL PROTECTED]; 
Sent: Friday, August 09, 2002 11:49 AM
Subject: RE: Is it possible to change the browser's address/location URL
without Redirect?


 One option:

 If there's an erro in form 2,
 Save the user's form data in some session variables
 Then use a META HTTP-EQUIV=Refresh CONTENT=0; URL=/step2 tag to get
the
 user's browser to redirect.
 Then populate the form with the data and error message you saved in
his/her
 session object.

 There are obviously many other ways to do this... but if you're using some
 sort of session data structure, this is probably the easiest way to get it
 done.

 Shawn



  -Original Message-
  From: Harry Zhu [mailto:[EMAIL PROTECTED]]
  Sent: August 9, 2002 2:26 PM
  To: [EMAIL PROTECTED]
  Subject: Is it possible to change the browser's address/location URL
  without Redirect?
 
 
  Looks like my explanation is too long or too bad.
  The simple idea is in page step 1, after the
 
  form action=/step/2 method=post.../form
 
  submitted, I want the browser show something
  http://www.example.com/step/1/error, instead of
  http://www.example.com/step/2,
  if there is a need for user to correct the data submitted.
 
  It might be accomplished by using one of the approaches
  outlined below, but
  I was wondering if there's other way that can save the overhead of the
  write/read or resend the data, and the re-process. Probably
  not much we can
  do if the URL displayed in the browser's address/location bar
  depends only
  on the action value of the form submitted, not based on the
  server response?
 
  Harry
 
 
 
  - Original Message -
  From: Harry Zhu [EMAIL PROTECTED]
  To: mod_perl list [EMAIL PROTECTED]
  Sent: Thursday, August 08, 2002 4:22 PM
  Subject: Can I change the browser's address/location?
 
 
   Suppose I have a generic content handler to handle requst
   /step/1, /step/2, ..., /step/n
  
   Location /step
 SetHandler perl-script
 PerlHandler MyHandler
  
   /Location
  
   #MyHandler.pm
   package MyHandler;
   sub handler {
 my $r=shift;
 my $step = substr($r-path_info(),1);
  
 #do something before fetch the content
  
 #fetch content: usually include a form that will assign action
   /step/($step+1)
  
   }
  
   So if everything goes well, the user will follow through
  from step 1, step
   2, until fnish.
   Now if in the #do something ... part, something is wrong, it will
  usually
   require user go back to the same step, for example, to fill the form
  again.
   The way my old cgi script does is just generate the form
  with prefilled
   value plus some error message indicate what's wrong. It
  works ok but the
   browser location will show /step/($step+1) while it actually is
  /step/$step.
   Now that I am working it on mod-perl I thought I should be
  able to do
   something about it. I briefly browsed the 2 mod-perl books (eagle,
   cookbook), and could not found a simple solution yet  (or I
  missed it?). I
   was think using one of the folowing might work:z
   1) save the request data in a temp file and redirect or
  http-refresh to
   /step/$step?$session_id or /step/$step/error?$session_id
   Remember the content is dynamic and depend on the input
  form data, so
  simple
   redirect may not work.
   Looks like Apache will not post the form data when redirect
  with Location?
  
   2) print a short form with hidden data and assign
  action=/step/$step/error
   then submit right away (onload=form.submit()?)
  
   Does anybody have a simple solution, e.g. without redirect?
  Is it possible
   to change the URI showing in the browser's address/location bar?
  
   I would appreciated if somebody can pointer me to the right
  direction.
  
   Harry
  
  
 
 






Re: Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread Andrew Ho

Hello,

HZI was wondering if that network trip can be avoided.

The answer is no.

You might be able to use JavaScript to do it on certain browsers, but I'm
reasonably sure you can't do it on recent IE and Netscape browsers.

Why do you want to do this? You could use base href/ or similar if your
goal is just to make links are relative to a certain root.

Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
--




Re: Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread Harry Zhu

The question is not about how to make links relative to root. The purpose is
to show correctly the user what the step he is at in the process. If no
mistake, he would be taken to step 2, but since the data has error and he
needs correct it, so I would like the browser indicating he is still in the
step 1. Although it's not that important an issue.

Did you mean javascript can change the URL text displayed in the (some
version of) browser's address/location bar? I know it is used to display
text in status. Noemally the use of Javascript to validate the data can
almost eliminate the needing of such network trip, but not always.

Thanks,
Harry

- Original Message -
From: Andrew Ho [EMAIL PROTECTED]
To: Harry Zhu [EMAIL PROTECTED]
Cc: mod_perl List 
Sent: Friday, August 09, 2002 4:40 PM
Subject: Re: Is it possible to change the browser's address/location URL
without Redirect?


 Hello,

 HZI was wondering if that network trip can be avoided.

 The answer is no.

 You might be able to use JavaScript to do it on certain browsers, but I'm
 reasonably sure you can't do it on recent IE and Netscape browsers.

 Why do you want to do this? You could use base href/ or similar if your
 goal is just to make links are relative to a certain root.

 Humbly,

 Andrew

 --
 Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
 Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
 Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
 --






Re: Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread Peter Bi

It is the browser that controls the URL in the Address bar. So one has to
make another call to get the URL refreshed. If you are worry about the
speed, you may

1) return an error code in case of error
2) in Apache's httpd.conf, config that specific error to display
/step/1/error

A simply redirection does the same job.

Peter

- Original Message -
From: Harry Zhu [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 09, 2002 11:26 AM
Subject: Is it possible to change the browser's address/location URL without
Redirect?


 Looks like my explanation is too long or too bad.
 The simple idea is in page step 1, after the

 form action=/step/2 method=post.../form

 submitted, I want the browser show something
 http://www.example.com/step/1/error, instead of
 http://www.example.com/step/2,
 if there is a need for user to correct the data submitted.

 It might be accomplished by using one of the approaches outlined below,
but
 I was wondering if there's other way that can save the overhead of the
 write/read or resend the data, and the re-process. Probably not much we
can
 do if the URL displayed in the browser's address/location bar depends only
 on the action value of the form submitted, not based on the server
response?

 Harry



 - Original Message -
 From: Harry Zhu [EMAIL PROTECTED]
 To: mod_perl list [EMAIL PROTECTED]
 Sent: Thursday, August 08, 2002 4:22 PM
 Subject: Can I change the browser's address/location?


  Suppose I have a generic content handler to handle requst
  /step/1, /step/2, ..., /step/n
 
  Location /step
SetHandler perl-script
PerlHandler MyHandler
 
  /Location
 
  #MyHandler.pm
  package MyHandler;
  sub handler {
my $r=shift;
my $step = substr($r-path_info(),1);
 
#do something before fetch the content
 
#fetch content: usually include a form that will assign action
  /step/($step+1)
 
  }
 
  So if everything goes well, the user will follow through from step 1,
step
  2, until fnish.
  Now if in the #do something ... part, something is wrong, it will
 usually
  require user go back to the same step, for example, to fill the form
 again.
  The way my old cgi script does is just generate the form with prefilled
  value plus some error message indicate what's wrong. It works ok but the
  browser location will show /step/($step+1) while it actually is
 /step/$step.
  Now that I am working it on mod-perl I thought I should be able to do
  something about it. I briefly browsed the 2 mod-perl books (eagle,
  cookbook), and could not found a simple solution yet  (or I missed it?).
I
  was think using one of the folowing might work:z
  1) save the request data in a temp file and redirect or http-refresh to
  /step/$step?$session_id or /step/$step/error?$session_id
  Remember the content is dynamic and depend on the input form data, so
 simple
  redirect may not work.
  Looks like Apache will not post the form data when redirect with
Location?
 
  2) print a short form with hidden data and assign
action=/step/$step/error
  then submit right away (onload=form.submit()?)
 
  Does anybody have a simple solution, e.g. without redirect? Is it
possible
  to change the URI showing in the browser's address/location bar?
 
  I would appreciated if somebody can pointer me to the right direction.
 
  Harry
 
 






Re: Is it possible to change the browser's address/location URL without Redirect?

2002-08-09 Thread Harry Zhu

Simple redirection does not do the same job, because the /step/1/error
page is not a simple error page - I would like it to reload the same form in
step 1 with the values filled and some message indicating what's to be
correct.

Looks like the network trip (redirect/refresh) can not be avoid. Then the
session mechanism maybe better for the speed since it sends less data.

Harry


- Original Message -
From: Peter Bi [EMAIL PROTECTED]
To: Harry Zhu [EMAIL PROTECTED]; 
Sent: Friday, August 09, 2002 5:18 PM
Subject: Re: Is it possible to change the browser's address/location URL
without Redirect?


 It is the browser that controls the URL in the Address bar. So one has
to
 make another call to get the URL refreshed. If you are worry about the
 speed, you may

 1) return an error code in case of error
 2) in Apache's httpd.conf, config that specific error to display
 /step/1/error

 A simply redirection does the same job.

 Peter

 - Original Message -
 From: Harry Zhu [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, August 09, 2002 11:26 AM
 Subject: Is it possible to change the browser's address/location URL
without
 Redirect?


  Looks like my explanation is too long or too bad.
  The simple idea is in page step 1, after the
 
  form action=/step/2 method=post.../form
 
  submitted, I want the browser show something
  http://www.example.com/step/1/error, instead of
  http://www.example.com/step/2,
  if there is a need for user to correct the data submitted.
 
  It might be accomplished by using one of the approaches outlined below,
 but
  I was wondering if there's other way that can save the overhead of the
  write/read or resend the data, and the re-process. Probably not much we
 can
  do if the URL displayed in the browser's address/location bar depends
only
  on the action value of the form submitted, not based on the server
 response?
 
  Harry
 
 
 
  - Original Message -
  From: Harry Zhu [EMAIL PROTECTED]
  To: mod_perl list [EMAIL PROTECTED]
  Sent: Thursday, August 08, 2002 4:22 PM
  Subject: Can I change the browser's address/location?
 
 
   Suppose I have a generic content handler to handle requst
   /step/1, /step/2, ..., /step/n
  
   Location /step
 SetHandler perl-script
 PerlHandler MyHandler
  
   /Location
  
   #MyHandler.pm
   package MyHandler;
   sub handler {
 my $r=shift;
 my $step = substr($r-path_info(),1);
  
 #do something before fetch the content
  
 #fetch content: usually include a form that will assign action
   /step/($step+1)
  
   }
  
   So if everything goes well, the user will follow through from step 1,
 step
   2, until fnish.
   Now if in the #do something ... part, something is wrong, it will
  usually
   require user go back to the same step, for example, to fill the form
  again.
   The way my old cgi script does is just generate the form with
prefilled
   value plus some error message indicate what's wrong. It works ok but
the
   browser location will show /step/($step+1) while it actually is
  /step/$step.
   Now that I am working it on mod-perl I thought I should be able to do
   something about it. I briefly browsed the 2 mod-perl books (eagle,
   cookbook), and could not found a simple solution yet  (or I missed
it?).
 I
   was think using one of the folowing might work:z
   1) save the request data in a temp file and redirect or http-refresh
to
   /step/$step?$session_id or /step/$step/error?$session_id
   Remember the content is dynamic and depend on the input form data, so
  simple
   redirect may not work.
   Looks like Apache will not post the form data when redirect with
 Location?
  
   2) print a short form with hidden data and assign
 action=/step/$step/error
   then submit right away (onload=form.submit()?)
  
   Does anybody have a simple solution, e.g. without redirect? Is it
 possible
   to change the URI showing in the browser's address/location bar?
  
   I would appreciated if somebody can pointer me to the right direction.
  
   Harry