Miki,

Thanks a lot - the mystery has been solved. It had to do with the way I was
handling the POST route.
It seems it needs explicit 'binding' as you mentioned

  (POST "/" {params :params} (view-output (params "my_datum"))))
  or

  (POST "/" {{a "my_datum"} :params} ...)



Thanks again!

Victor

On Fri, Sep 17, 2010 at 9:18 PM, Miki <miki.teb...@gmail.com> wrote:

> See http://clojure.pastebin.com/ncaULRbU (works for me).
> I've changed the POST handler to use *params* and I also think you're
> not closing the :h2 in view output.
>
> On Sep 17, 3:11 pm, Victor Olteanu <bluestar...@gmail.com> wrote:
> > Sure, here it is:
> >
> > (defn view-layout [& content]
> >   (html
> >    (doctype :xhtml-strict)
> >    (xhtml-tag "en"
> >               [:head
> >                [:meta {:http-equiv "Content-type"
> >                        :content "text/html; charset=utf-8"}]
> >                [:title "Datum"]]
> >               [:body content])))
> >
> > This was actually taken from an online tutorial with some changes (
> http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applica...
> >  )
> > More specifically, in the original tutorial there was an additional
> > intermediate step when the input was "parsed":
> > (parse-input a b)
> >
> > with the function
> > (defn parse-input [a b]
> >   [(Integer/parseInt a) (Integer/parseInt b)])(parse-input a b)
> >
> > However in my case I'm just dealing with strings, so there's no
> "parseInt"
> > involved. So I assumed my input is strings-- which doesn't seem to be the
> > case, and there are no "parseString" methods that I could use instead.
> >
> > Thank you,
> > Victor
> >
> >
> >
> > On Fri, Sep 17, 2010 at 5:30 PM, Miki <miki.teb...@gmail.com> wrote:
> > > My *guess* it's somehow connected to the code of "view-layout" since
> > > it shows the representation of the function "str".
> > > Can place the full code (including view-layout) somewhere?
> >
> > > On Sep 17, 12:35 pm, Victor <bluestar...@gmail.com> wrote:
> > > > Hi all,
> >
> > > > I'm having a problem that may or may not be Compojure specific, so I
> > > > thought I'd try this group since the answer is probably easy- I am
> > > > just stuck.
> >
> > > > I am reading the string through a simple form
> >
> > > > (defn view-input []
> > > >  (view-layout
> > > >   [:h2 "Enter one datum:"]
> > > >   [:form {:method "post" :action "/"}
> > > >    [:input.datum {:type "text" :name "my_datum"}]
> > > >    [:input.action {:type "submit" :value "Add"}]]))
> >
> > > > where the route for posting is
> >
> > > >  (POST "/" [a]
> > > >   (view-output a)))
> >
> > > > I then simply want to display what I entered and submitted (say I
> > > > typed the string "a").
> >
> > > > (defn view-output [a]
> > > >  (view-layout
> > > >   [:h2 (str "This is what you entered: " a)))
> >
> > > > However what I get is this:
> >
> > > > clojure.core$...@1e731e90
> >
> > > > Thanks in advance for your help!
> > > > Victor
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Clojure" group.
> > > To post to this group, send email to clojure@googlegroups.com
> > > Note that posts from new members are moderated - please be patient with
> > > your first post.
> > > To unsubscribe from this group, send email to
> > > clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> <clojure%2bunsubscr...@googlegroups.com<clojure%252bunsubscr...@googlegroups.com>>
> > > For more options, visit this group at
> > >http://groups.google.com/group/clojure?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to