This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-20
Channels
- # announcements (1)
- # bangalore-clj (27)
- # beginners (82)
- # boot (4)
- # chestnut (1)
- # cider (22)
- # cljs-dev (26)
- # cljsrn (4)
- # clojure (118)
- # clojure-dev (18)
- # clojure-italy (2)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-russia (1)
- # clojure-spec (15)
- # clojure-uk (125)
- # clojurescript (61)
- # core-async (74)
- # cursive (2)
- # datomic (41)
- # duct (6)
- # editors (7)
- # emacs (3)
- # events (1)
- # figwheel-main (3)
- # fulcro (111)
- # hoplon (11)
- # jobs-discuss (97)
- # lein-figwheel (99)
- # off-topic (34)
- # onyx (4)
- # parinfer (9)
- # pedestal (4)
- # precept (2)
- # re-frame (5)
- # reagent (2)
- # reitit (4)
- # ring-swagger (11)
- # shadow-cljs (104)
- # spacemacs (4)
- # tools-deps (19)
- # vim (8)
- # yada (15)
Thanks Malcolm! yeah I’m quite excited about the project, but somehow Yada docs seem to let me down quite often. I’ve opened an issue at github edge repo.
I am trying to work with a form, but the resource is not parsing the form body automatically, so the only thing I have is the :body key in the context, no [:parameters :form], in fact :parameters is an empty map {} I am wondering if there is a different thing I need to do to define the resource..? At the moment I am saying that it consumes: application/x-www-form-urlencoded
@maleghast can you post both how you're calling it?
and also you're :parameters
map
The form in the HTML page uses: method="post" action="[URL HERE]" The :post section of the resource looks like this:
:post
{:consumes [{:media-type #{"application/x-www-form-urlencoded"}
:charset "UTF-8"}]
:response
(fn [ctx]
(println ctx)
(let [formdata (:body ctx)
db-insert-result (add-organisation-to-db formdata)]
(case (yada/content-type ctx)
"text/html" (selmer/render-file
"admin/organisation-new-add.html"
{:title ""
:data db-insert-result
:ctx ctx}))))}
I don't have a :parameters map in the Resource definition - I just want the whole form to be tokenised and turned into a keyword-based map.
I think you might need to specify :parameters
to get it to work, give me a sec to double check that
@maleghast you should be able to do what you want by adding :parameters {:form {schema/Keyword schema/Any}}
to your map
without that, it'll just ignore the form parameters
side note: It's better to explicitly list the parameters you want sent to this endpoint in the :parameters
schema (i.e. {:form {:param1 schema/String :param2 schema/Num}}
)
but, you do you 🙂