选择框进行更新后,Primefaces Commandbutton不起作用 [英] Primefaces Commandbutton not working after an update made by select box

查看:135
本文介绍了选择框进行更新后,Primefaces Commandbutton不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有四个选择菜单.我的问题很奇怪,即如果您单击提交而不选择任何下拉菜单,它就可以正常工作.但是,当我选择子组下拉菜单,然后再单击提交按钮时,它没有调用要调用的方法...这是我的代码.

Iam having four select menus in my page. My problem is weird i.e. without selecting any of the dropdown menu if you click on submit, it is working fine. But when i select subgroup dropdown menu and later if i click the submit button it is not calling the method it intended to call... Heres my code..

<?xml version="1.0"?>
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head/>
<h:body>    
<h:form id="form">
            <p:panel header="Service Details" style="width:800px">

            <p:panelGrid columns="4">
                <h:outputText value="Group: " />
                <p:selectOneMenu value="#{helpDeskBean.group}">
                    <f:selectItem itemLabel="Select One" itemValue="" />
                    <f:selectItems value="#{helpDeskBean.createRequestDTO.groupsList}" var="item" itemLabel="#{item.groupdesc}" itemValue="#{item.groupid}" />
                    <p:ajax event="change" listener="#{helpDeskController.groupChange}" update="subGroupID"  partialSubmit="true"/>
                </p:selectOneMenu>


                <h:outputText value="Sub Group: " />
                <p:selectOneMenu value="#{helpDeskBean.subGroup}" id="subGroupID">
                <f:selectItem itemLabel="Select One" itemValue="" />
                    <f:selectItems value="#{helpDeskBean.groupChangeList}" var="item2" itemLabel="#{item2.subGroupDesc}" itemValue="#{item2.subGroupCode}" />
                    <p:ajax event="change" listener="#{helpDeskController.SubGroupChange}" update="serviceID" />
                </p:selectOneMenu>

                <h:outputText value="Service: " />
                <p:selectOneMenu value="#{helpDeskBean.service}" id="serviceID">
                <f:selectItem itemLabel="Select One" itemValue="" />
                    <f:selectItems value="#{helpDeskBean.groupChangeList}" var="item1" itemLabel="#{item1.serviceDesc}" itemValue="#{item1.serviceCode}" />
                </p:selectOneMenu>

            </p:panelGrid>
        </p:panel>
<p:commandButton value="Submit" actionListener="#{helpDeskController.createHDRequest}"/>
    </h:form>
</h:body>

推荐答案

在第二个下拉列表的ajax更改事件中,您正在更新ID'serviceID'.如果在您的DOM树中找不到该组件,则服务器控制台将出现错误,指出未找到组件"serviceID".

On Second dropdown's ajax change event you are updating an id 'serviceID'. If this component is not found in your DOM tree you would have got an error in the server console stating component 'serviceID' not found.

如果收到该错误,则可能是原因.通过查看页面视图源,提供要更新的组件ID的确切ID.

If you got that error then that may be the possible cause. Give exact id of the component id you want to update by checking your page view source.

希望这会有所帮助.

这篇关于选择框进行更新后,Primefaces Commandbutton不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆