I've been working on a Clojure project for some time and was wondering how to navigate user from one page to another after clicking the submit-button. Code goes like this:
(defn view-film-input []
(view-layout
[:body {:style "background-color: #F2FB78"}
[:h2 "Add new film"]
(form-to [:post "/addfilm" ]
(label "movname" "Film title: ")
(text-field :txtname) [:br]
(label "prname" "Producer name: ")
(text-field :txtprname) [:br]
(label "location" "File location: ")
(text-field :txtlocation)[:br]
(label "duration" "Duration(minutes): ")
(text-field :txtduration)[:br]
(submit-button "Save"))]))
Now, this works but I would like to navigate user to same "Add new film" page, or refresh the form after clicking "Save" button, instead it shows just a blank page.
This is the GET\POST part:
(GET "/addfilm" [] (view-film-input))
(POST "/addfilm" [txtname txtprname txtlocation txtduration]
(insert-flick txtname txtprname txtlocation txtduration 90) )
Thanks in advance!