Vuk Vasić
Vuk Vasić

Reputation: 1408

Creating select in BeanEditForm from Hibernate and Tapestry IOC

How can I make a select box in BeanEditForm for some key that is not showing in BeanEditForm for example I have a table:

Person:

IDPerson
PersonName

and table

Contact:

IDContact
IDPerson
ContactName

and I want to create a BeanEditForm with allows me to choose a person from list when adding a contact in tapestry 5.3.

Upvotes: 0

Views: 368

Answers (2)

lance-java
lance-java

Reputation: 27994

You can either use a beaneditform with 'add' and a block parameter, as suggested by Michal Gruca, or you can use the beaneditor directly. A <t:beaneditform /> is just a <t:beaneditor /> inside a <t:form />

eg:

<t:form t:id="contactForm">
    <t:errors/>
    <t:beaneditor object="contact" include="firstName,lastName" />
    <t:label for="person" /><t:select t:id="person" value="contact.person" model="..." />
    <t:beaneditor object="contact" include="height,age" />
    <input type="submit" value="message:submit-label" />
</t:form>

Upvotes: 1

Michal Gruca
Michal Gruca

Reputation: 522

Please try following

<t:beaneditor t:id="contact" add="person" object="contact">
    <p:person>
        <t:select .../>
    </p:person>
</t:beaneditor>

It should work, but I'm typing that from top of my head.

Upvotes: 1

Related Questions