[Lift] Re: keep showing user entered value in toForm when it doesn't validate?

2009-08-25 Thread David Pollak
Harry, What's going on is that the instance of your model class that's being validated is different from the instance of the model class that's used to render your form. There are two ways to deal with this: RequestVars and StatefulSnippets. For RequestVars: object MyThing extends

[Lift] Re: keep showing user entered value in toForm when it doesn't validate?

2009-08-25 Thread harryh
There are two ways to deal with this: RequestVars and StatefulSnippets. What about in cases where I'm not creating a new Thing, but editing an existing one. It seems like what maybe should be done is down in the guts of the toForm function it should be examining S.attr([the field guid]) it if

[Lift] Re: keep showing user entered value in toForm when it doesn't validate?

2009-08-25 Thread David Pollak
On Tue, Aug 25, 2009 at 12:36 PM, harryh har...@gmail.com wrote: There are two ways to deal with this: RequestVars and StatefulSnippets. What about in cases where I'm not creating a new Thing, but editing an existing one. In the RequestVar case, you could have a function associated with

[Lift] Re: keep showing user entered value in toForm when it doesn't validate?

2009-08-25 Thread Naftoli Gugenheim
I think what David is saying is that your misdiagnosing the problem. Validation is not resetting the value; it's just failing to save, and the next page load is fetching whatever's in the database, which is the old value.Could you post the could the generates the form, and the code that retrieves

[Lift] Re: keep showing user entered value in toForm when it doesn't validate?

2009-08-25 Thread David Pollak
On Tue, Aug 25, 2009 at 12:52 PM, harryh har...@gmail.com wrote: I'm not sure I understand what you're suggesting. Can you be a little more explicit about your suggestion? OK, so I'm editing an existing Thing with name currently = Harry (which is valid as it has = 5 chars) I do a

[Lift] Re: keep showing user entered value in toForm when it doesn't validate?

2009-08-25 Thread harryh
I think what David is saying is that your misdiagnosing the problem. Validation is not resetting the value; it's just failing to save, and the next page load is fetching whatever's in the database, which is the old value Ah yes. OK, this makes perfect sense now. I should have understood