I'll start by giving this problem a bit of background.  I've been charged
with adding 'Postcode Lookup' functionality to the registration form on our
site.  When a user enters a postcode, it calls off to a third party service,
and we provide a set of possible addresses in a drop down box.  The user
selects one, and we use this selection to populate a bunch of form fields. 
There are three clear states here 

a) Initial State (Postcode Field)
b) Select Address State (Select box)
c) Display selected address state (a bunch of text fields)

I felt that Tapestry Zones in conjunction with action links (using Inge's
ZoneUpdater mixin to get the form values into the page class) should be
suitable for this problem.  

Of course our registration form has a whole bunch of fields besides address
fields, and we want to encapsulate the postcode lookup logic into a
component.  So, on to the problem.  Here is a cutdown version of my
template:

<t:form t:id="registerForm">

... other fields here ...

<t:addressLookup/>

<t:submit/>

</t:form>

Address Lookup Template:

        <t:zone t:id="addressZone" id="addressZone" t:update="show">
                <t:delegate to="addressStatus" />
        </t:zone>

        <t:block t:id="findAddressBlock">
                <t:label for="findHouseNumber" />
                <t:textfield t:id="findHouseNumber" t:value="houseNumber"/>
                <t:label for="postCode" />
                <t:textfield t:id="findPostCode" t:value="postCode"/>
                <t:actionlink t:id="findAddressLink" zone="addressZone">Find
Address</t:actionlink>
        </t:block>      

<t:block t:id="selectAddressBlock">
                <t:select t:id="selectAddress" t:value="selectedAddressIndex"
t:model="addressModel" blankOption="never" t:mixins="zoneUpdater"
zone="addressZone" t:event="selectChange" t:clientEvent="change"/>
                <t:actionlink t:id="selectAddressLink">Select 
Address</t:actionlink>
        </t:block>

        <t:block t:id="displayAddressBlock">
        .... some form fields here ...
        </t:block>

The actionlinks and basic zone functionality is working fine, but when my 
addressStatus delegate returns (for example) the selectAddressBlock as part
of a zone update, I get the following error:

"org.apache.tapestry5.ioc.internal.util.TapestryException: The Select
Address component must be enclosed by a Form component"

Whats happening here is that Tapestry is unable to attach the new form
fields to their containing form.  I've had a read around and the only
solution seems to be to put the whole form inside the zone.  This isn't
really viable in this case, because our register form is quite large and it
breaks the nice componentisation that Tapestry is giving us.

Thought I'd throw it out there to the ever helpful Tapestry mailing list and
see if you can provide any nuggets of advice or perhaps suggestions for an
alternative to using Zones.

-- 
View this message in context: 
http://old.nabble.com/Updating-a-Zone-with-just-form-fields-%28not-the-form-itself%29-tp28679165p28679165.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to