> Hi,
>
> I'm getting the following error

I can't reproduce the error. Can you create a cut down version that
causes the problem?

Here is my attempt to recreate.


    @Property
    private String blockId = "one";

    @Component
    private Zone blockZone;

    @Component
    private Form oneForm;

    @Property
    private String oneText;

    @Component
    private Form twoForm;

    @Property
    private String twoText;

    @Inject
    private ComponentResources resources;

    public Block onSuccessFromOneForm() {
        blockId = "two";
        return blockZone.getBody();
    }

    public Block onSuccessFromTwoForm() {
        blockId = "one";
        return blockZone.getBody();
    }

    public Block getTheBlock() {
        return resources.getBlock(blockId);
    }


<t:zone t:id="blockZone">
    <t:delegate to="theBlock"/>
    <t:block t:id="one">
        <t:form t:id="oneForm" t:zone="blockZone">
            <t:label for="oneText">One</t:label>
            <t:textfield t:id="oneText"/>
            <t:submit/>
        </t:form>
    </t:block>
    <t:block t:id="two">
        <t:form t:id="twoForm" t:zone="blockZone">
            <t:label for="twoText">Two</t:label>
            <t:textfield t:id="twoText"/>
            <t:submit/>
        </t:form>
    </t:block>
</t:zone>

Josh

On Wed, Feb 23, 2011 at 10:52 AM, Rich M <rich...@moremagic.com> wrote:
> Hi,
>
> I'm getting the following error
>
> Caused by: java.lang.NullPointerException
>    at
> org.apache.tapestry5.corelib.components.Form._$environment_read_renderSupport(Form.java)
>    at
> org.apache.tapestry5.corelib.components.Form.beginRender(Form.java:245)
>    at org.apache.tapestry5.corelib.components.Form.beginRender(Form.java)
>
> when I re-render the main zone in my page from an ActionLink or FormSuccess
> event method.
>
> More about my page:
>
> The page is divided into 8 blocks, and 6 of the blocks encapsulate a form,
> as such:
>
> <zone>
> <delegate />
> <block>
> <form>
> </form>
> <block>
>  ...
> <block>
> <form>
> </form>
> </block>
> </zone>
>
> When first loading the page, it delegates to the first block. You can fill
> out the form and then submit the form. Upon submitting the form, it triggers
> the onSuccessFromForm method, which updates the Block for the Delegate and
> returns the zone component.
>
> At this point, I get the NullPointerError which points directly to the line
> in the TML file declaring the <t:form> in the Block that should now be
> delegated to. I declare the t:id of the form and in the page class each Form
> is declared as a private Form with the @Component annotation.
>
> Any help or advice would be appreciated. I have used the
> Zone/Block/Event-Method strategy in another Component of mine successfully,
> but the Blocks in that Component never contained Form components, which
> seems to be the added complication.
>
> Also, I had the Events working when I just returned the page class itself by
> String reference, but I'd prefer to update the Zone over reload the Page
> each time.
>
> Thanks,
> Rich
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

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

Reply via email to