You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jonny Cavell <jc...@iii.co.uk> on 2001/05/03 15:51:51 UTC

problem with print OUT in embperl2

Hi,
 
The following code:
 
---cut---
[$ foreach  $num(1..2)  $]
    [- print OUT "hello "; -]
    goodbye
[$ endforeach $]
---cut---
 
Gives the following output:
 
---cut---
hello hello goodbye hello hello goodbye 
---cut---
 
Cheers
 
Jonny
 

http://www.iii.co.uk 
Interactive Investor International is a leading UK Internet personal 
finance service that provides individuals with the capability to identify, 
compare, monitor and buy online a number of financial products and services.

Interactive Investor Trading Limited, a subsidiary of Interactive Investor 
International plc, is regulated by the SFA.

Re: multiple reposts

Posted by ___cliff rayman___ <cl...@genwax.com>.
they only get to see it and hit submit if their cache has not
expired. i send my form pages as no cache, otherwise it
is hard to maintain state.

1) user selects 4 wigits and submits a page, gets redirected to a cart.
2) changes quantity in cart from 4 to 6, resubmits, everythings cool.
3) instead of hitting your 'return to shopping' button, hits BACK
and goes to the original page.
4) if the cache is not expired, the browser will show a quantity of 4,
which is no longer correct.

u and i know why this occurred, my shoppers don't.  if the page is no cache and
VISITED is used then:
1) user hits BACK button
2) browser asks to repost because cache expired
3) our software ignores the post since the VISITED does not match.
4) we send back a quantity of 6 to the browser.

of course, even with the above there are other problems.  i sure
wish state handling was better integrated into the http protocol.

Gerald Richter wrote:

> > except for the pesky BACK button in the browser.  they can hit
> > BACK then repost in the browser.
> >
>
> Yes, but then they come back to the input form, so they have to click the
> submit button again. This maybe an issuse or may not, depending on your
> application. Normaly there is always a possibilty to come back to that input
> form the same way they had come first, but I agree to you that sometime a
> VISITED counter is the better solution, also, I think, it more work to
> implement it, especialy when you work in a sessionless environment...
>
> Gerald
>

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: multiple reposts

Posted by Gerald Richter <ri...@ecos.de>.
> except for the pesky BACK button in the browser.  they can hit
> BACK then repost in the browser.
>

Yes, but then they come back to the input form, so they have to click the
submit button again. This maybe an issuse or may not, depending on your
application. Normaly there is always a possibilty to come back to that input
form the same way they had come first, but I agree to you that sometime a
VISITED counter is the better solution, also, I think, it more work to
implement it, especialy when you work in a sessionless environment...

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



> --
> ___cliff rayman___cliff@genwax.com___http://www.genwax.com/
>
> Gerald Richter wrote:
>
> > Hi
> > >
> > > This question is not exactly to this list, but I don't know to put it
> > > elsewhere. Anyway, pages are written in Embperl ;)
> > >
> > > I have a form which posts some data to database. None of items are
unique,
> > > I cannot check that some fields exists already. When form is posted,
all
> > > is ok. Newly posted data is presented to user. But when user presses
> > > reload  button on browser, then it posts the data again. Of course it
> > > asks, but can
> > > I avoid this behaviour at all?
> > >
> > >
> >
> > The way I used to solve this problem, is to make two steps. The first
step
> > writes the data into the database and then issuses a redirect to a
second
> > page that displays the result (and doesn't contains any post data, only
get
> > if necessary). By this, if the user presses reload, he only gets the
result
> > page reloaded, but no data is posted again.
> >
> > Gerald
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: multiple reposts

Posted by ___cliff rayman___ <cl...@genwax.com>.
except for the pesky BACK button in the browser.  they can hit
BACK then repost in the browser.

i increment a VISITED session variable and field.  each time the user posts,
i increment the VISITED field, send them a copy and keep a copy in their
session.  if they post with a VISITED field which is less than the one in the
session, then i know they are reposting old data.  deciding what to do about
it is more of an issue.  tell them, ignore them, accept the new updates, ignore
the new updates.

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/

Gerald Richter wrote:

> Hi
> >
> > This question is not exactly to this list, but I don't know to put it
> > elsewhere. Anyway, pages are written in Embperl ;)
> >
> > I have a form which posts some data to database. None of items are unique,
> > I cannot check that some fields exists already. When form is posted, all
> > is ok. Newly posted data is presented to user. But when user presses
> > reload  button on browser, then it posts the data again. Of course it
> > asks, but can
> > I avoid this behaviour at all?
> >
> >
>
> The way I used to solve this problem, is to make two steps. The first step
> writes the data into the database and then issuses a redirect to a second
> page that displays the result (and doesn't contains any post data, only get
> if necessary). By this, if the user presses reload, he only gets the result
> page reloaded, but no data is posted again.
>
> Gerald
>




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: multiple reposts

Posted by Gerald Richter <ri...@ecos.de>.
Hi
>
> This question is not exactly to this list, but I don't know to put it
> elsewhere. Anyway, pages are written in Embperl ;)
>
> I have a form which posts some data to database. None of items are unique,
> I cannot check that some fields exists already. When form is posted, all
> is ok. Newly posted data is presented to user. But when user presses
> reload  button on browser, then it posts the data again. Of course it
> asks, but can
> I avoid this behaviour at all?
>
>

The way I used to solve this problem, is to make two steps. The first step
writes the data into the database and then issuses a redirect to a second
page that displays the result (and doesn't contains any post data, only get
if necessary). By this, if the user presses reload, he only gets the result
page reloaded, but no data is posted again.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


multiple reposts

Posted by Neeme Vool <ne...@eenet.ee>.
Hi

This question is not exactly to this list, but I don't know to put it
elsewhere. Anyway, pages are written in Embperl ;)

I have a form which posts some data to database. None of items are unique,
I cannot check that some fields exists already. When form is posted, all
is ok. Newly posted data is presented to user. But when user presses
reload  button on browser, then it posts the data again. Of course it
asks, but can
I avoid this behaviour at all?


Neeme Vool

Tel: +372 7 302 113
Fax: +372 7 302 111
E-mail: Neeme.Vool@eenet.ee



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: problem with print OUT in embperl2

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

> ---cut---
> [$ foreach  $num(1..2)  $]
>     [- print OUT "hello "; -]
>     goodbye
> [$ endforeach $]
> ---cut---
>

As I wrote in one mail in the last days, print OUT inside a loop doesn't
work. This is a bug in Embperl, but not so easy to fix. Use

[$ foreach  $num(1..2)  $]
    [+ "hello " +]
    goodbye
[$ endforeach $]

as workaround (which is faster anyway)

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org