简体   繁体   English

JSF从不同形式更新组件,两个形式的前缀为false

[英]JSF update component from different form, boths forms with prependid false

Hi i have this sceneario, i have 2 forms each of them with preprendId=false, the first one have ah:panelGroup that i want to update from the second h:form. 嗨,我有这个场景,我有2个表单,每个表单都带有preprendId = false,第一个具有ah:panelGroup,我想从第二个h:form更新。 The problem that i have is that i dont know what String i have to put for update my panelGroup. 我的问题是我不知道要更新面板组必须输入什么字符串。 I tried with this strings: 我尝试了以下字符串:

panelGroupComboId and :panelGroupComboId panelGroupComboId和:panelGroupComboId

But i always get: Cannot find component with expression ":panelGroupComboId" referenced from... 但是我总是得到: 找不到从表达式中引用的表达式为“:panelGroupComboId”的组件。

Because i need to use preprendId=false at least in the first form (where my panelGroup is) i cannot set preprendIf=true, but if i did it i could update my component with any problem using: :loginFormRegistroId:panelGroupComboId 因为我至少需要在第一种形式(我的panelGroup所在的位置)中使用preprendId = false,所以我无法设置preprendIf = true,但是如果这样做了,我可以使用以下任何问题来更新组件::loginFormRegistroId:panelGroupComboId

But remember i NEED to use preprendId= false, when i use preprendId=false i can see using firebug that my h:panelGroup is converted as a div with the id panelGroupComboId, then thats why i dont how do i have to call for update it. 但是请记住,我需要使用preprendId = false,当我使用preprendId = false时,我可以使用Firebug看到我的h:panelGroup被转换为具有id panelGroupComboId的div,这就是为什么我不必调用它来更新它的原因。

Is preprendId=true the only way to this works? 是preprendId = true唯一可行的方法吗?

FIRST FORM 第一表格

 <h:form id="loginFormRegistroId" prependId="false">
    <h:panelGroup id="panelGroupComboId" layout="block">
        <select id="comboCarreraId" name="comboCarreraId" class="form-control">
            <ui:repeat value="#{miBean.list}" var="obj">
                <option value="#{obj.id}">#{obj.name}</option>
            </ui:repeat>
        </select>
    </h:panelGroup>
</h:form>

SECOND FORM 第二表格

 <h:form prependId="false">
    <p:remoteCommand
        name="cargarCarrerasRemoteCommand"
        process="@this"
        actionListener="#{miBean.myListener}"
        update="panelGroupComboId">
    </p:remoteCommand>
</h:form>

By the way i DONT want to update the entire first FORM, just my h:panelGroup 顺便说一句我想要更新整个第一种形式,只是我的H:panelGroup中

Remove prependId from the forms. 从表单中删除prependId。 Update the code as 将代码更新为

<h:form>
    <p:remoteCommand
        name="cargarCarrerasRemoteCommand"
        process="@this"
        actionListener="#{miBean.myListener}"
        update=":loginFormRegistroId:panelGroupComboId">
    </p:remoteCommand>
</h:form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM