Re: [Haskell-cafe] Fwd: web-routes and forms

Hello, As Jeremy said, the HTML returned by formHtml is meant to be placed inside the a <form> tag: it does not include a <form> tag. You should use it like this:
H.form ! A.enctype (H.stringValue $ show enctype) ! A.method "POST" ! A.action "/" $ do html -- The HTML rendered by formHtml H.input ! A.type_ "submit" ! A.value "Submit"
(with or without the submit button).
Cheers,
Jasper
On Jan 27, 2011 10:54 AM, "Corentin Dupont"
Hello Jasper, Do you have an idea?
Thanks, Corentin
---------- Forwarded message ---------- From: Jeremy Shaw
Date: Thu, Jan 27, 2011 at 2:22 AM Subject: Re: web-routes and forms To: Corentin Dupont Cc: haskell On Wed, Jan 26, 2011 at 4:33 PM, Corentin Dupont
wrote: Now turning to digestive functors, I don't see where do goes the "A.action actionURL" part that was in traditionnal forms? It seems I need it for routing the result of the form.
I think you will find formHtml is returning you the stuff that goes inside the <form> tag, but does not actually include the form tag itself ?
I am not sure how to modify the attrs using blaze-html. I think that is a missing feature of the digestive-functors-blaze package. In digestive-functors-hsp there is a function:
setAttrs :: (EmbedAsAttr x attr, XMLGenerator x, Monad m, Functor m) => Form m i e [HSX.GenXML x] a -> attr -> Form m i e [HSX.GenXML x] a setAttrs form attrs = mapView (map (`set` attrs)) form
You probably need something similar for blaze.
- jeremy

OK thanks, now it's clear!
On Thu, Jan 27, 2011 at 11:13 AM, Jasper Van der Jeugt
Hello,
As Jeremy said, the HTML returned by formHtml is meant to be placed inside the a <form> tag: it does not include a <form> tag. You should use it like this:
H.form ! A.enctype (H.stringValue $ show enctype) ! A.method "POST" ! A.action "/" $ do html -- The HTML rendered by formHtml H.input ! A.type_ "submit" ! A.value "Submit"
(with or without the submit button).
Cheers, Jasper
On Jan 27, 2011 10:54 AM, "Corentin Dupont"
wrote: Hello Jasper, Do you have an idea?
Thanks, Corentin
---------- Forwarded message ---------- From: Jeremy Shaw
Date: Thu, Jan 27, 2011 at 2:22 AM Subject: Re: web-routes and forms To: Corentin Dupont Cc: haskell On Wed, Jan 26, 2011 at 4:33 PM, Corentin Dupont
wrote: Now turning to digestive functors, I don't see where do goes the "A.action actionURL" part that was in traditionnal forms? It seems I need it for routing the result of the form.
I think you will find formHtml is returning you the stuff that goes inside the <form> tag, but does not actually include the form tag itself ?
I am not sure how to modify the attrs using blaze-html. I think that is a missing feature of the digestive-functors-blaze package. In digestive-functors-hsp there is a function:
setAttrs :: (EmbedAsAttr x attr, XMLGenerator x, Monad m, Functor m) => Form m i e [HSX.GenXML x] a -> attr -> Form m i e [HSX.GenXML x] a setAttrs form attrs = mapView (map (`set` attrs)) form
You probably need something similar for blaze.
- jeremy

Hello again,
is there a way to had a "hidden" field in digestive-functor-blaze?
I'm using it to transmit some data...
Thanks,
Corentin
On Thu, Jan 27, 2011 at 11:21 AM, Corentin Dupont wrote: OK thanks, now it's clear! On Thu, Jan 27, 2011 at 11:13 AM, Jasper Van der Jeugt <
jaspervdj@gmail.com> wrote: Hello, As Jeremy said, the HTML returned by formHtml is meant to be placed
inside the a <form> tag: it does not include a <form> tag. You should
use it like this: H.form ! A.enctype (H.stringValue $ show enctype)
! A.method "POST" ! A.action "/" $ do
html -- The HTML rendered by formHtml
H.input ! A.type_ "submit" ! A.value "Submit" (with or without the submit button). Cheers,
Jasper On Jan 27, 2011 10:54 AM, "Corentin Dupont" Hello Jasper,
Do you have an idea? Thanks,
Corentin ---------- Forwarded message ----------
From: Jeremy Shaw On Wed, Jan 26, 2011 at 4:33 PM, Corentin Dupont
Now turning to digestive functors, I don't see where do goes the
"A.action
actionURL" part that was in traditionnal forms?
It seems I need it for routing the result of the form. I think you will find formHtml is returning you the stuff that goes
inside the <form> tag, but does not actually include the form tag
itself ? I am not sure how to modify the attrs using blaze-html. I think that
is a missing feature of the digestive-functors-blaze package. In
digestive-functors-hsp there is a function: setAttrs :: (EmbedAsAttr x attr, XMLGenerator x, Monad m, Functor m) =>
Form m i e [HSX.GenXML x] a
-> attr
-> Form m i e [HSX.GenXML x] a
setAttrs form attrs = mapView (map (`set` attrs)) form You probably need something similar for blaze. - jeremy

Hello,
I've backported the `inputHidden` combinator to the 0.0.2 branch, you
can find it on hackage as digestive-functors-blaze-0.0.2.2.
Hope this helps,
Cheers,
Jasper
On Fri, Jan 28, 2011 at 8:10 PM, Corentin Dupont
Hello again, is there a way to had a "hidden" field in digestive-functor-blaze? I'm using it to transmit some data... Thanks, Corentin
On Thu, Jan 27, 2011 at 11:21 AM, Corentin Dupont
wrote: OK thanks, now it's clear!
On Thu, Jan 27, 2011 at 11:13 AM, Jasper Van der Jeugt
wrote: Hello,
As Jeremy said, the HTML returned by formHtml is meant to be placed inside the a <form> tag: it does not include a <form> tag. You should use it like this:
H.form ! A.enctype (H.stringValue $ show enctype) ! A.method "POST" ! A.action "/" $ do html -- The HTML rendered by formHtml H.input ! A.type_ "submit" ! A.value "Submit"
(with or without the submit button).
Cheers, Jasper
On Jan 27, 2011 10:54 AM, "Corentin Dupont"
wrote: Hello Jasper, Do you have an idea?
Thanks, Corentin
---------- Forwarded message ---------- From: Jeremy Shaw
Date: Thu, Jan 27, 2011 at 2:22 AM Subject: Re: web-routes and forms To: Corentin Dupont Cc: haskell On Wed, Jan 26, 2011 at 4:33 PM, Corentin Dupont
wrote: Now turning to digestive functors, I don't see where do goes the "A.action actionURL" part that was in traditionnal forms? It seems I need it for routing the result of the form.
I think you will find formHtml is returning you the stuff that goes inside the <form> tag, but does not actually include the form tag itself ?
I am not sure how to modify the attrs using blaze-html. I think that is a missing feature of the digestive-functors-blaze package. In digestive-functors-hsp there is a function:
setAttrs :: (EmbedAsAttr x attr, XMLGenerator x, Monad m, Functor m) => Form m i e [HSX.GenXML x] a -> attr -> Form m i e [HSX.GenXML x] a setAttrs form attrs = mapView (map (`set` attrs)) form
You probably need something similar for blaze.
- jeremy

Thanks!!!!
On Sat, Jan 29, 2011 at 11:33 AM, Jasper Van der Jeugt
Hello,
I've backported the `inputHidden` combinator to the 0.0.2 branch, you can find it on hackage as digestive-functors-blaze-0.0.2.2.
Hope this helps, Cheers, Jasper
On Fri, Jan 28, 2011 at 8:10 PM, Corentin Dupont
wrote: Hello again, is there a way to had a "hidden" field in digestive-functor-blaze? I'm using it to transmit some data... Thanks, Corentin
On Thu, Jan 27, 2011 at 11:21 AM, Corentin Dupont
wrote: OK thanks, now it's clear!
On Thu, Jan 27, 2011 at 11:13 AM, Jasper Van der Jeugt
wrote: Hello,
As Jeremy said, the HTML returned by formHtml is meant to be placed inside the a <form> tag: it does not include a <form> tag. You should use it like this:
H.form ! A.enctype (H.stringValue $ show enctype) ! A.method "POST" ! A.action "/" $ do html -- The HTML rendered by formHtml H.input ! A.type_ "submit" ! A.value "Submit"
(with or without the submit button).
Cheers, Jasper
On Jan 27, 2011 10:54 AM, "Corentin Dupont"
wrote:
Hello Jasper, Do you have an idea?
Thanks, Corentin
---------- Forwarded message ---------- From: Jeremy Shaw
Date: Thu, Jan 27, 2011 at 2:22 AM Subject: Re: web-routes and forms To: Corentin Dupont Cc: haskell On Wed, Jan 26, 2011 at 4:33 PM, Corentin Dupont
wrote: Now turning to digestive functors, I don't see where do goes the "A.action actionURL" part that was in traditionnal forms? It seems I need it for routing the result of the form.
I think you will find formHtml is returning you the stuff that goes inside the <form> tag, but does not actually include the form tag itself ?
I am not sure how to modify the attrs using blaze-html. I think that is a missing feature of the digestive-functors-blaze package. In digestive-functors-hsp there is a function:
setAttrs :: (EmbedAsAttr x attr, XMLGenerator x, Monad m, Functor m) => Form m i e [HSX.GenXML x] a -> attr -> Form m i e [HSX.GenXML x] a setAttrs form attrs = mapView (map (`set` attrs)) form
You probably need something similar for blaze.
- jeremy
participants (2)
-
Corentin Dupont
-
Jasper Van der Jeugt