Re: [racket] formlet-fill

2011-11-22 Thread Jay McCarthy
On Mon, Nov 21, 2011 at 12:00 PM, Jordan Schatz wrote: > On Mon, Nov 21, 2011 at 06:32:18AM -0700, Jay McCarthy wrote: > > I can imagine implementing something like... > > > > (define record-formlet > > (formlet > > ;; Define the input format > > ([name (hash-

Re: [racket] formlet-fill

2011-11-21 Thread Jordan Schatz
On Mon, Nov 21, 2011 at 06:32:18AM -0700, Jay McCarthy wrote: > I can imagine implementing something like... > > (define record-formlet > (formlet > ;; Define the input format > ([name (hash-ref this 'name)] > [company (hash-ref this 'company)] >

Re: [racket] formlet-fill

2011-11-21 Thread Jay McCarthy
Your version that breaks mainly breaks because you are mutating the record and recomputing the formlet, rather than saving the formlet in the continuation for both the display and the processing. As far as what you'd like to write, I think that's a good start, but there's a few problems. 1) A lin

Re: [racket] formlet-fill

2011-11-19 Thread Jordan Schatz
Let me see if I can explain what I'm after better. The app that I am porting is mostly CRUD (Create Read Update Delete), one twist though is that we never explicitly use create, if a user wants to create a new record they actually edit a copy of the most recent record, so a form always has values (

Re: [racket] formlet-fill

2011-11-18 Thread Jay McCarthy
You need to make a new formlet that knows about the default values. We could imagine a macro that makes this nicer, but in general it will need to be something that creates a new one. Is there some reason you don't want to do that? I can imagine something like (formlet-display) that took the old

[racket] formlet-fill

2011-11-18 Thread Jordan Schatz
I have a pattern of user interaction that is common in my web app: I have a db record, I present it to the user in a form, the user edits the form, submits it, server side logic validates it, and then returns the same form with the updated record. I want to port the app to Racket, and I thought