You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use (form a-form an-action a-renderer) to create forms. The action should be taken upon a valid form submission. Suppose we have the following:
(define (handler some-argument)
(define n (random 10))
(define a-form ...) ; asks to guess the number
(define (an-action guessed-number)
(if (= n guessed-number) (put 'success?#true) (put 'success?#false)))
(define (a-renderer rw) ...)
(form a-form an-action a-renderer))
Then after submission of the form with a guessed-number, the handler is called again, which generates a new n. If a valid guess was provided, it then compares the guessed-number against this new value of n, not the original one -- which is of course not the intended behavior.
How can we fix this?
The text was updated successfully, but these errors were encountered:
For next session: require that handlers return pages. Those pages can then capture the current renderer for each handler, which forms can then re-use w/o re-running the other code in the handler. Effectively, page is when the "response" part of a handler starts and it should be re-runnable.
We use
(form a-form an-action a-renderer)
to create forms. The action should be taken upon a valid form submission. Suppose we have the following:Then after submission of the form with a guessed-number, the handler is called again, which generates a new
n
. If a valid guess was provided, it then compares theguessed-number
against this new value ofn
, not the original one -- which is of course not the intended behavior.How can we fix this?
The text was updated successfully, but these errors were encountered: