Here's the complete xhtml file:
<lift:surround with="default" at="content">
    <head>
        <title>
            <lift:loc>Edit Person</lift:loc>
        </title>
    </head>
    <h1>You are editing: </h1>
    <lift:PersonSnippets.save form="post">
        <person:id/>
        <person:version/>
        <div class="span-8 last">
            <div class="span-3"><label for="firstName">
                <lift:loc>First Name</lift:loc>
            </label></div>
            <div class="span-5">
                <person:firstName/>
            </div>
        </div>
        <div class="span-8 last">
            <div class="span-3"><label for="middleName">
                <lift:loc>Middle Name</lift:loc>
            </label></div>
            <div class="span-5">
                <person:middleName/>
            </div>
        </div>
        <div class="span-8 last">
            <div class="span-3"><label for="lastName">
                <lift:loc>Last Name</lift:loc>
            </label></div>
            <div class="span-5">
                <person:lastName/>
            </div>
        </div>
        <person:submit/>
    </lift:PersonSnippets.save>

    <div class="span-24 last">
        <h2>Contact Mechanisms</h2>
        <lift:PersonSnippets.addContactMechanism form="post">
            <label for="comment">
                <lift:loc>Comment</lift:loc>
            </label><contactMechanism.comment/><br/>
            <input type="radio" name="contactMechanism"
value="Email"/><label>Email</label>
            <input type="radio" name="contactMechanism" value="Postal
Address"/><label>Postal Address</label>
            <input type="radio" name="contactMechanism" value="Phone
Number"/><label>Phone Number</label>
            <input type="radio" name="contactMechanism"
value="Facebook"/><label>Facebook</label>
            <input type="radio" name="contactMechanism"
value="Twitter"/><label>Twitter</label>
            <input type="text" name="value"/>
            <button type="submit">Save</button>
            <table summary="A list of all the ways to contact this person or
organizations" title="Contact Mechanisms">
                <thead>
                <tr>
                    <th>Comment</th>
                    <th>From</th>
                    <th>Thru</th>
                    <th>Mechanism</th>
                </tr>
                </thead>
            </table>
        </lift:PersonSnippets.addContactMechanism>

    </div>

</lift:surround>

On Wed, Nov 25, 2009 at 4:35 PM, Derek Chen-Becker <dchenbec...@gmail.com>wrote:

> That markup should be in a template file somewhere, which would then call
> the snippets appropriately. I don't see markup for a second form, but I
> might just be missing it.
>
> A couple of other notes:
>
>
>    - Generally, on links, omit the suffix and Lift will then do I18N
>    lookup for you as needed. That means use "/contact/person/edit" instead of
>    "/contact/person/edit.html"
>    - When you're deleting in JPA, there's no need to do a merge first.
>    Just obtain a reference instead and delete that. It's more efficient. Your
>    code would look like:
>
>   def doDelete() = {
>     try {
>       Model.removeAndFlush(Model.getReference(classOf[Person],
> person.getId());
>
>       notice("Deleted " + person.getFirstName() + " " +
> person.getLastName())
>       redirectTo("/contact/list")
>
>     } catch {
>       case pe: PersistenceException => error("Error removing person");
> Log.error("Error removing person", pe);
>     }
>   }
>
>
> On Wed, Nov 25, 2009 at 4:26 PM, Timothy Perrett 
> <timo...@getintheloop.eu>wrote:
>
>> Lift does not use markup like that - there is no magic mapping between
>> persistence and view.
>>
>> You would most likly have to construct the appropriate master -> detail
>> code in your snippets and work like that.
>>
>> Cheers, Tim
>>
>> On 25 Nov 2009, at 23:16, Jim Barrows wrote:
>>
>> > I'm using JPA, and need to do a One->Many, or master detail view.  So I
>> tried the obvious:
>> > <lift:PersonSnippets.save form="post">
>> > <!-- form -->
>> >  </lift:PersonSnippets.save>
>> > <lift:PersonSnippets.addContactMechanism form="post">
>> > </lift:PersonSnippets.addContactMechanism>
>> >
>> > However, the HTML that gets generated is the same form for both.
>> > Is there an example somewhere I've missed about how to do this?
>> > --
>> > James A Barrows
>> >
>> >
>> > --
>> >
>> > You received this message because you are subscribed to the Google
>> Groups "Lift" group.
>> > To post to this group, send email to lift...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
>> .
>> > For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/liftweb?hl=en.
>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>



-- 
James A Barrows

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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