Yassine
Yassine

Reputation: 29

p:commandButton doesn't work inside tabview

I'm trying to show a dialog using a p:commandButton, the p:commandButton is inside a tabView. I tried this way but without sucess, am I missing something? Thx

<p:tab  title="Observations">                   
    <div class="field select-field clearfix">                           
        <label>Bloc</label>
        <h:panelGroup layout="block" styleClass="actions">
            <h:form>
                <p:commandButton value="Add" styleClass="add"
                    action="#{blocCtrl.initBlocSetting}"
                    update=":dialog2" oncomplete="add_bloc.show()">
                </p:commandButton>
            </h:form>
        </h:panelGroup>
        <p:dialog id="dialog2" header="Bloc" modal="true"
            widgetVar="add_bloc" minHeight="40" width="895">
            <div class="popup-body">
                <h:form>                
                    <h:panelGroup layout="block"
                        styleClass="popup-field clearfix last">
                        <label class="the-label">Type bloc*</label>
                        <div class="the-field">
                            <h:inputText
                                value="#{blocCtrl.blocSettings.type}"
                                required="true"
                                requiredMessage="Error" />
                        </div>
                    </h:panelGroup>
                    <div class="popup-actions">
                        <button
                            onclick="$('.ui-dialog-titlebar-close').trigger('click');return false;"
                            class="red-btn">Annuler</button>
                        <h:commandButton value="OK" type="submit"
                            action="#{blocCtrl.addBlocSetting}"
                            update="add_messagePanel"
                            oncomplete="if(args &amp;&amp; args.success){add_bloc.hide();}"
                            styleClass="green-btn" />
                    </div>
                </h:form>
            </div>
        </p:dialog>
    </div>              

Upvotes: 1

Views: 1361

Answers (1)

Tadas B.
Tadas B.

Reputation: 176

I had the same situation and after removing form tag before p:tabView it started to work

   <h:form>
        <p:tabView>
            <p:tab title="title">
                <h:form>
                  <p:commandButton actionListener="... />
                </h:form>
            </p:tab> 
        </p:tabView>
    </h:form>

Upvotes: 1

Related Questions