Coder Social home page Coder Social logo

mmontone / cl-forms Goto Github PK

View Code? Open in Web Editor NEW
40.0 11.0 5.0 1.86 MB

Web forms handling library for Common lisp

Home Page: http://mmontone.github.io/cl-forms

License: MIT License

Common Lisp 84.82% HTML 0.38% JavaScript 11.86% CSS 2.94%
lisp common-lisp forms web-form html-forms

cl-forms's People

Contributors

brown avatar mmontone avatar vindarel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cl-forms's Issues

Demo: /renderers URL not found

Hello,

I at last try the demo and discover an outstanding library. The demo is great and it's the first of its kind I see.

The /renderers URL is a 404 and a rgrep doesn't give much hints.

Documentation, form rendering with :who

Hi,

I installed cl-forms, I tried to follow the documentation and to render a form.

https://mmontone.github.io/cl-forms/#Basics

(let ((form (forms::find-form 'fields-form)))
  (forms:with-form-renderer :who
    (forms:render-form form)))

I first got a no-applicable method error:

; Evaluation aborted on #<SB-PCL::NO-APPLICABLE-METHOD-ERROR {100F0E30F3}>.

I installed cl-forms.who (I saw it on Slime completion but not in the doc), now I get:

FORMS.WHO:*HTML* is unbound. Please bind it before rendering forms. See FORMS.WHO:*HTML* documentation.

OK, the doc says:

The stream where the form is rendered to, when using the who renderer.
Make sure to bind this before rendering your form.

Example:

(who:with-html-output (forms.who:*html*)
   (forms:render-form my-form))

Value: NIL

Trying:

(who:with-html-output (FORMS.WHO:*HTML*)
          (let ((form (forms::find-form 'fields-form)))
            (forms:with-form-renderer :who
              (forms:render-form form))))

=> nope, error: "The value of CL-FORMS.WHO:HTML is NIL, which is not of type STREAM."

What would an example that works at the REPL?

Then I could send a patch for the doc.

Thanks

Form creation from a Mito model?

cl-forms allows to create a form from a model class: https://mmontone.github.io/cl-forms/#Models

where one has to give all the fields, as well as their input type

:fields (forms::make-form-fields
                            `((name :string :label "Name"
                                    :accessor person-name)

I wish we could infer those from a Mito model and create a form with shorter code.

Example:

(defclass book ()

   (title
    :accessor title
    :initarg :title
    :initform nil
    :type string
    :col-type (:varchar 128))

  (title-ascii
    :initform nil 
    ;; etc
   )

   (shelf
    :accessor shelf
    :initform nil
    :col-type (or :null shelf)
    :documentation "Shelf"))

  (:metaclass mito:dao-table-class))

(defclass shelf ()
  ((name
    :initarg :shelf
    :accessor name
    :initform ""
    :col-type (or :null (:varchar 128))))
  (:metaclass mito:dao-table-class))

I found a couple introspection functions:

(mito.class:find-slot-by-name 'book 'shelf)
#<MITO.DAO.COLUMN:DAO-TABLE-COLUMN-CLASS OPENBOOKSTORE.MODELS::SHELF>

(mito.class:table-column-type *)
SHELF  
;; and not (or :null shelf) ?

Ideally we would create a form with all the fields and right types by default and we could exclude some fields (title-ascii).

This would bring us closer to a CRUD admin dashboard… (I got how to list tables and records, adding and editing a record generically is a non-obvious next step).

Any feedback is welcome!

Some systems failed to build for Quicklisp dist

Building with SBCL 2.1.7.62-417920f09 / ASDF 3.3.5 for quicklisp dist creation.

Trying to build commit id d7a116f

cl-forms.demo fails to build with the following error:

; caught ERROR:
;   during macroexpansion of (CHECK-TYPE #:FORM0 (QUOTE FORM)). Use *BREAK-ON-SIGNALS* to intercept.
;    Quoted type specifier in CHECK-TYPE: (QUOTE FORM)
;   See also:
;     The ANSI Standard, Macro CHECK-TYPE
...
Unhandled UIOP/LISP-BUILD:COMPILE-FILE-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING {1001BF0103}>: COMPILE-FILE-ERROR while compiling #<CL-SOURCE-FILE "cl-forms.demo" "test" "demo-tests" "models">

Full log here

Spinneret renderer backend

Gday,

I thought i'd ask before committing time to this, if I was to write a backend renderer for spinneret , would this functionality be something that you would be interested in ?

I do not mind if you wish to write it, or if I was to. I did not want to duplicate effort.

If you are fine with me trying my hand at it, what should I be aware of to make this easier for you to maintain/accept.

Thanks in advance,

[Help] djula howto

How to use cl-form with djula? i've tried to understand it from djula test file, but i get

{# Error: Unknown tag FORM #} {# Error: Unknown tag FORM-START #} {# Error: Unknown tag FORM-ROW #} {# Error: Unknown tag FORM-ROW #} {# Error: Unknown tag FORM-ROW #} {# Error: Unknown tag FORM-ROW #} {# Error: Unknown tag FORM-END #}

Thank you.

Generated pdf has wrong backtick

Gday,

I've only begun learning this tool. I have found that the generated pdf has a problem with the example generated code.

In section 3.1. Basics

 (with-output-to-string (forms.who:*html*)
        (let ((form (forms:find-form `fields-form)))
                (forms:with-form-renderer :who
                   (forms:render-form form))))

Should be.

 (with-output-to-string (forms.who:*html*)
        (let ((form (forms:find-form 'fields-form)))
                (forms:with-form-renderer :who
                   (forms:render-form form))))

Note the change in backtick before fields-forms.

Trying these at the repl as a copy-and-paste from the pdf was what made me aware of the issue.

Thanks for your time. Please feel free to close this issue if I have made it in error.

Possibly adding a mailer action to demo

Thank you for cl-forms, this is exactly what I have been looking for.

I am able to have a contact form rendered. Now I would like to mail the form via SMTP client, but, as a beginner, I have no clue on the next step.

I know this is not part of cl-forms , but would it be possible at all to add this action to the demo part, so I can learn?

There would be no need to add a dependency to e.g. cl-smtp, just a way to use the system SMTP client, via OS call?

Thank you for considering this!

Failed to build for Quicklisp dist

Building with SBCL 2.0.9.5-442f54894 / ASDF 3.3.1 for quicklisp dist creation.

Commit id f2e4b7e

cl-forms.peppol fails to build with the following error:

Unhandled ASDF/FIND-COMPONENT:MISSING-DEPENDENCY in thread #<SB-THREAD:THREAD "main thread" RUNNING {1001A50103}>: Component #:PEPPOL not found, required by #<SYSTEM "cl-forms.peppol">

Full log here

Missing dependency

(require :cl-forms.demo)

ASDF could not load cl-forms.demo because Component #:FIVEAM not found, required by #<SYSTEM "cl-forms.test">.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.