mmontone / cl-forms Goto Github PK
View Code? Open in Web Editor NEWWeb forms handling library for Common lisp
Home Page: http://mmontone.github.io/cl-forms
License: MIT License
Web forms handling library for Common lisp
Home Page: http://mmontone.github.io/cl-forms
License: MIT License
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!
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.
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">
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.
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.
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!
(require :cl-forms.demo)
ASDF could not load cl-forms.demo because Component #:FIVEAM not found, required by #<SYSTEM "cl-forms.test">.
Hi could this library support spinneret?
If so, what would be required?
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,
SBCL cannot compile system cl-forms.demo because of a bad type declaration. Here's a Quicklisp failure log:
http://report.quicklisp.org/2023-11-06/failure-report/cl-forms.html#cl-forms.demo
The following pull request fixes the problem: #12
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">
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.