[racket] Servlets and forms

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Oct 11 14:59:24 EDT 2010

I anticipate we'd want some wrapper around formlets that check if the
code passes some predicate and it would be nice to have a predicate
language that could be compiled to JS for client-side validation and
ui updating.


On Mon, Oct 11, 2010 at 12:40 PM, Markku Rontu <markku.rontu at iki.fi> wrote:
> Hey,
> On Sun, Oct 10, 2010 at 1:12 AM, Jay McCarthy <jay.mccarthy at gmail.com>
> wrote:
>> On Sat, Oct 9, 2010 at 12:35 PM, Markku Rontu <markku.rontu at iki.fi> wrote:
>> > Hello,
>> >
>> > I've been experimenting with the web servlets lately and I'm not sure
>> > how I
>> > should be handling forms. The documentation guides me to use formlets
>> > instead of bindings but the library seems rather incomplete. I mean
>> > based on
>> > the source it seems to be missing radio buttons and files, for example.
>> > Also
>> The next release has support for almost all the form elements:
>> http://github.com/plt/racket/blob/master/collects/web-server/formlets/input.rkt
> Good to know.
>> > the documentation seems to refer mostly to an older version with
>> > input-string etc. Using bindings is not a problem itself, it's what I'm
>> > used
>> > to in Java-land but then again I have to build a complete framework on
>> > top
>> > of it to handle everything properly.
>> I suspect most people using bindings directly.
>> >
>> > I managed to get simple formlets working as well as the direct bindings
>> > but
>> > where am I supposed to do validation? Guess I do need to build the
>> > framework
>> > myself?
>> I'm not sure I understand the question. If your application has
>> special requirements on input, then you'll need to check it. Probably
>> on the request handler for the form action.
> Well I was looking for a framework or an existing practice of doing it
> right. Typical web frameworks have some XML-based DSL or whatnot for
> validating expressions. I was wondering if there was any neat solutions for
> Racket yet. There is a lot of grunt work regarding showing validation
> errors, directing back or forward, validating common things such as dates
> etc. that I think should have some support. How? I'm not completely happy
> with the solutions I've seen so far...
>> > If somebody has some useful pointers or best practices, I'd appreciate
>> > it.
>> > Or is there some framework I'm missing? What's in it for the formlets in
>> > the
>> > future? Where is the active development now?
>> I'm interested in hearing what is missing from the formlets library.
>> I'm also interested in a reusable validation layer, but I haven't come
>> up with a good design yet, so there's nothing in the distribution.
> I can only think of in terms of existing Java-frameworks but I dislike them
> anyway. I'll try to think of something different next so I'll get back with
> some ideas a bit later. My approach is anyway to change quite much how
> typical UI code is written so have to think the fundamentals a bit more to
> have some good first idea.
> -Markku

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.