Open utterances-bot opened 4 years ago
Thank you for this series of reviews, they are informative and inspiring.
In regards to template libraries, would you consider having a look at xml-generator? It is available here.
I didn't know about xml-generator. Will look at it. Thank you!
Thank you for considering it. It mentions " It mostly should work on other implementations", and I was able to load it from quicklisp's local-projects
by commenting out first two ACL specific forms (with #+(version= ...)
, but got stuck after that, because of ACL named-readtable facility.
Hi, could please show examples of various HTML form elements like option, select, checkbox, textarea etc.
@sree-kumar This is very natural. Just use s-expressions the same way as you use HTML tags:
CL-USER> (spinneret:with-html-string
(:form :action "/some/url" :method "POST"
(:select :name "foo"
(:option :value 1 "First")
(:option :value 2 "Second"))
(:textarea :name "Large Text"
"Initial text content")))
"<form action=/some/url method=POST>
<select name=foo>
<option value=1>First
<option value=2>Second
</select>
<textarea name=\"Large Text\">Initial text content</textarea>
</form>"
Thanks a lot.
On Mon, Jun 21, 2021 at 3:53 PM Alexander Artemenko < @.***> wrote:
@sree-kumar https://github.com/sree-kumar This is very natural. Just use s-expressions the same way as you use HTML tags:
CL-USER> (spinneret:with-html-string (:form :action "/some/url" :method "POST" (:select :name "foo" (:option :value 1 "First") (:option :value 2 "Second")) (:textarea :name "Large Text" "Initial text content")))"
"— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/40ants/lisp-project-of-the-day/issues/34#issuecomment-864919215, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSBZXWDJRE5KD4V34BNZFLTT4HJLANCNFSM4RTQNIPA .
Help again. Hunchentoot returns "Checkbox" items separately. For example,
<input type=checkbox name=vehicle value=Car> Car
<input type=checkbox name=vehicle value=Bike> Bike
<input type=checkbox name=vehicle value=Cycle> Cycle
And the request object is something like:
(vehicle . Car) (vehicle . Cycle)
Is it possible to get a single list of selected items?
Thanks in advance.
Update: I saw this answer in stack overflow. But they are dealing with only check boxes.
Hey @sree-kumar, I find that writing HTML in the form of s-expressions is more difficult too, and not often necessary. It is mainly necessary when we generate it from a program, not really when we write it by hand. What if you wrote HTML with Djula or Ten instead? You'll be able to copy snippets (even start with ready-to-use templates, for example see Bulma templates) and find help more easily. Best,
Sorry, I think you got my question wrong. I am asking about handling request information (GET and POST) in Hunchentoot. Since, I am a beginner, I would like to do everything myself so that I understand the basics. Once I am comfortable, I shall look into the templates you have suggested. By the way, I looked into Bulma Templates, but found it difficult for now.
@vindarel, I have gone through your lisp journey post about introducing default-parameter-type
.
Could please explain on that? Thanks.
I solved the problem by adding,
((vehicle :parameter-type 'list))
from this link Thanks for your support.
spinneret
https://40ants.com/lisp-project-of-the-day/2020/09/0189-spinneret.html