Ramy
Ramy

Reputation: 21261

hiccup form-helper with compojure

Exception: Exception in thread "main" java.io.FileNotFoundException: Could not locate hiccup/form_helpers__init.class or hiccup/form_helpers.clj on classpath:

I'm trying to get a toy compojure app up and running. The original app was from CloudBees and their ClickStart app for Clojure/Compojure. I'm trying to add a simple form (that won't persist anything yet) using hiccup form_helpers but I'm getting a ClassNotFound exception. Here's what I've done:

project.clj:

(defproject mywebapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.4.0"]
             [compojure "1.1.1"]
             [hiccup "1.0.1"]]
:plugins [[lein-ring "0.7.3"]]
:ring {:handler mywebapp.routes/app}
:profiles
{:dev {:dependencies [[ring-mock "0.1.3"]]}})

views.clj:

(ns mywebapp.views
(:use [hiccup core page]
    [hiccup form-helpers :only [form-to label text-area submit-button]]))
...
(defn shout-form []
[:div {:id "shout-form" }
 (form-to [:post "/form"]
        (label "shout" "What do you want to SHOUT?")
        [:br]
        (text-area "shout")
        [:br]
        (submit-button "SHOUT!"))])
...

Upvotes: 4

Views: 941

Answers (1)

Ramy
Ramy

Reputation: 21261

Ah, looks like I just had an old example of forms in hiccup. form_helpers was from a previous version.

if I change my views.clj file from this:

(:use [hiccup form-helpers])

to look like this:

(:use [hiccup form])

(and presumably this would work though i haven't tested it):

(:use [hiccup form :only [form-to label text-area submit-button]])

I don't get the error anymore.

To clarify: the package used to be called "form_helpers" and is now simply called "form".

Upvotes: 3

Related Questions