FeAFigueiredo
FeAFigueiredo

Reputation: 11

How to bind component inside rich:modalPanel

I have a problem with rich:modalPanel and rich:calendar.

The code works without the modal, but when i include the components in the modal i recieve a nullpointer in the date.

Working:

<a4j:outputPanel id="datePanel">
    <a4j:region>
        <rich:calendar id="calendar" value="#{ myBean.myDate }" />

        <a4j:commandButton value="Confirm" reRender="tablePanel"
            action="#{ myBean.addToTable }" />
    </a4j:region>
</a4j:outputPanel>

Not working:

<rich:modalPanel id="mpCalendar" height="250" width="350" autosized="true"
    zindex="1000">
    <f:facet name="header">
        <h:outputText value="New date" />
    </f:facet>
    <f:facet name="controls">
        <h:graphicImage value="/images/close.gif"
            onclick="Richfaces.hideModalPanel('mpCalendar')"
            style="cursor:pointer" />
    </f:facet>
    <a4j:outputPanel id="datePanel">
        <a4j:region>
            <rich:calendar id="calendar" value="#{ myBean.myDate }" />

            <a4j:commandButton value="Confirm" reRender="tablePanel"
                action="#{ myBean.addToTable }" />
        </a4j:region>
    </a4j:outputPanel>
</rich:modalPanel>

My questions are: 1. Why when I put it inside the modal it doesnt work? 2. How can I fix it?

Upvotes: 1

Views: 714

Answers (1)

FeAFigueiredo
FeAFigueiredo

Reputation: 11

I found what was wrong.

My modalPanel was inside another form... I just put the modal outside the form and added a form into the modal.

Example:

<a4j:outputPanel id="datePanel">
    <a4j:form>
        <rich:calendar id="calendar" value="#{ myBean.myDate }" />

        <a4j:commandButton value="Confirm" reRender="tablePanel"
            action="#{ myBean.addToTable }" />
    </a4j:form>
</a4j:outputPanel>

<h:form> ...

Upvotes: 0

Related Questions