1

次のダイアログポップアップを開くポップアップボタンを持つjsfページがあります。

</h:form>
<p:dialog id="dialog" header="Select different user"
        widgetVar="dlg" appendToBody="true">

    <h:form id="form23">
        <h:panelGrid columns="2" cellpadding="5">
            <h:outputLabel for="username" value="Username:" />
            <p:inputText value="#{loginBean.username}" 
                id="username" required="true" label="username" />

            <h:outputLabel for="password" value="Password:" />
            <h:inputSecret value="#{loginBean.password}" 
                id="password" required="true" label="password" />

            <f:facet name="footer">
                <p:commandButton id="loginButton" value="Login" />
            </f:facet>
        </h:panelGrid>
    </h:form>
</h:form>

しかし、ポップアップとして開く代わりに、ページ自体の外に表示されています。ダイアログはメイン フォームの外にあります。ヘルプ!!


私はそれを試しましたが、それでも同じ問題が解決しません..以下は私の変更されたコードです..

<h:form id="create-ticket">
    <p:dialog id="dialog" header="Select different user" widgetVar="dlg" appendToBody="true">

    <h:panelGrid columns="2" cellpadding="5">
        <h:outputLabel for="username" value="Username:" />
        <p:inputText value="#{loginBean.username}" 
                id="username" required="true" label="username" />

        <h:outputLabel for="password" value="Password:" />
        <h:inputSecret value="#{loginBean.password}" 
                id="password" required="true" label="password" />

        <f:facet name="footer">
            <p:commandButton id="loginButton" value="Login" 
                />
        </f:facet>
    </h:panelGrid>

 </p:dialog>
     <h:panelGroup>
     <h:outputLabel value="#{I18N['Create_Ticket_for_other_users']}" styleClass="atf-header"></h:outputLabel>
    </h:panelGroup>
    <h:panelGroup id="search_section" layout="block"
       styleClass="atf-content-area atf-separarot-botton">   <!-- This is the section where we get the grey background -->
         <h:panelGroup id="input_search_section" styleClass="">
            <h:outputText id="name" value="Siddharth Mishra"    
            labelStyleClass="atf-label">
            </h:outputText>
        </h:panelGroup>
    <h:panelGroup styleClass="atf-right atf-inline-block">
        <p:commandButton id="btn_search" value="select different user"
            styleClass="atf-button-search" onclick="dlg.show();" type="button"
            >

        </p:commandButton>
    </h:panelGroup>

</h:panelGroup>

これで、ポップアップ ダイアログ セクション + h:panelgroup の下でポップアップを呼び出しているボタンが表示されるフォームが 1 つだけになりました。ここに画像の説明を入力

4

1 に答える 1

2

コードを再構築する必要があります。

*フォームを他のフォーム内にネストしないでください。

*p:dialog の終了タグがありません。

<h:form>    
    <p:dialog id="dialog" header="Select different user"
            widgetVar="dlg" appendToBody="true">

          //Content ex inputtext

    </p:dialog>

<p:commandButton value="Show Dialog" onclick="dlg.show();" type="button" />  
</h:form>
于 2013-03-05T08:56:08.840 に答える