Hmm. My first idea was #3, but that's such a hack. Lift should be better 
than that. My second thought was #1, and I'm still thinking about that, 
although #2 (which also occurred to me) looks like a good fallback.

I'll think more about this, but it seems to me like something Lift 
should do effortlessly (as it's something you see a lot, and Lift is so 
good at everything else).

Thanks!

Chas.

Marius wrote:
> Hi Charles,
> 
> Well if you add new input fields from JS obviously Lift has no idea
> about them and obviously there will be no function associated with
> them on server side.I guess what you can do is :
> 
> 1. When pressing the add field button you do an ajax request, register
> your function n server side and return the new input in Ajax
> response.
> 2. Just add a new input to your form and read thee values manually on
> server side when processing the form.
> 3. Define a limited set of "extra fields" ... say 20 fields (would
> probably be enough). All these fields are mapped on the server side
> but on client side just don;t show them. When user clicks "add new"
> you just subsequently make one field visible. I would probably chose
> this at this point.
> 
> P.S.
> On the new Record stuff I'm working to provide support for adding
> fields dynamically to a record but this will still be on server side.
> Maybe would worth an extension to that idea to generate JS code to add
> fields to a Record from client side as well. Such thing may have side
> effects when the Records is mapped to a RDBMS table .. such as adding
> a new field to a record, that record may not correspond to the table
> structure ...
> 
> Br's,
> Marius
> 
> On Oct 25, 9:23 pm, "Charles F. Munat" <[EMAIL PROTECTED]> wrote:
>> I have a Recipe form that allows for multiple Ingredients. (What's more,
>> each Ingredient has multiple fields.)
>>
>> I'd like the blank Recipe form to list, say, three blank Ingredient
>> subforms. But I'd like the user to be able to delete unneeded subforms
>> (via a - button next to each subform), or add more Ingredient subforms
>> (via a + button at the top of the list of Ingredients). This is a pretty
>> common situation, and I know how to do it using JQuery.
>>
>> But in starting to do this in Lift, I realize that there's a problem.
>> What are the names of those new fields? Lift encodes the names on the
>> server, so it seems like adding a new subform would require a trip to
>> the server (unless I included some ridiculous number of subforms, such
>> as 20, and then did a show/hide on them -- but that's a pretty kludgy
>> way to do things).
>>
>> Does anyone have an example of how to do this? Or ideas for the best
>> practice?
>>
>> Thanks!
>>
>> Chas.
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to