Naftoli, take a look on JsonForm & JsonHandler. It provides is A WAY
of allowing adding arbitrary fields to a form and process it on server
side in any way desired. Why? ... because with this mechanism you
don't need Lift's functions binding and inherently field naming
generation. My notes are NOT related to Mapper in fact this is
persistence agnostic.


Br's,
Marius

On Jul 23, 5:39 pm, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
> You don't need javascript. Just use submit buttons for add field etc. 
> actions. If you need relationships to be kept track of but not actually 
> created, store the delta in your StatefulSnippet -- current, added, and 
> removed children lists; then display a list of actual items by concatening 
> current and added, and filtering actual.filter(a => removed.forall(a.ne)).
> If the relationships are more complex, you may want to wait for me to commit 
> my one-to-one and one-to-many additions to Mapper in the near future B"H.
> I am actually doing something pretty similar, and I hope to commit soon a 
> number of utilities to make this easier.
> I'm assuming that you have tables and Mappers all set up to support this kind 
> of data structure?
>
> -------------------------------------
>
> marius d.<marius.dan...@gmail.com> wrote:
>
> There are several ways of doing it:
>
> 1. Use JSONForm (http://wiki.liftweb.net/index.php/
> HowTo_use_JSON_forms) in conjunction with JSONHandler and create new
> Input fields purely from JavaScript and adhere to your own naming
> conversion.
>
> 2. Before submitting the form start an Ajax request to add a field. On
> your Ajax request processing function you can create a new input
> field, associate your field function and return the JS back to client
> which will add the input field to your form. Hence when you are
> submitting the form, all your bound functions will be executed.
>
> Br's,
> Marius
>
> On Jul 23, 10:34 am, JanWillem Tulp <janwillem.t...@gmail.com> wrote:
>
> > Hi community,
>
> > I was wondering: what is a nice and efficient way to do the following
> > in Lift:
>
> > I would like to create a form where users can dynamically add fields
> > for a specific type of data. For instance, say I have a form with the
> > fields name, display name and date of birth. Of course, I can create a
> > a snippet where I can do my validation and other handling. Now I want
> > to add a button that adds an additional field, but I don't know
> > beforehand how the input of this new form field should be handled. The
> > options a user can pick from is fixed (for instance numeric field,
> > text field, email field, etc.) so that I can write validation and
> > handling for a specific type, but the user should be free to add as
> > many fields as he likes, of any type he likes.
>
> > Let me give you an example:
>
> > the current form contains:
>
> >     name, display name, date of birth.
>
> > One user clicks a button, and wants to add a phone number field, so
> > that his form will display:
>
> >     name, display name, date of birth, phone number
>
> > However, another user might add another type of field, for instance a
> > zipcode field, so that his form will display:
>
> >     name, display name, date of birth, zipcode
>
> > Of course, a field that expects a phone number should be validated
> > differently than a field that expects a zipcode.
>
> > How do I create this dynamic kind of form, since I can not map the
> > form fields directly to a fixed set of objects in my snippets, because
> > this is not known beforehand, but depends on user input. I hope you
> > understand my question, and that you have some good suggestions.
>
> > Thanks!
>
> > JanWillem Tulp
>
> > I hope that y
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to