简体   繁体   English

避免完全验证/提交p:selectOneListbox的值

[英]Avoid validating/ submitting p:selectOneListbox's value completely

I'm fetching selectItems list for a p:selectOneListbox via ajax using a request scoped bean. 我正在通过使用请求范围内的bean的ajax获取p:selectOneListbox selectItems列表。 Thus on submitting back the form I'm getting this error: 因此,在提交表单后,我得到了这个错误:

j_idt153:j_idt159:j_idt184:j_idt194: Validation Error: Value is not valid

I dont want to submit the value of p:selectOneListbox to any bean property that's why the value EL for that component was omitted but still JSF is validating the selected option & it is not there since my bean was request scoped. 我不想将p:selectOneListbox的值提交给任何bean属性,这就是为什么省略了该组件的值EL的原因,但JSF仍在验证所选的选项,并且由于我的bean被请求了作用域,所以它不存在。 Now I want to completely skip validating this component since this p:selectOneListbox is just for presentation purposes & its value is not used after the submit form process. 现在,我想完全跳过对该组件的验证,因为此p:selectOneListbox仅用于演示目的,并且在提交表单过程之后不使用其值。 How do I avoid validating/ submitting p:selectOneListbox 's value completely 如何避免完全验证/提交p:selectOneListbox的值

        <p:ajax event=".." listener="#{pim.retrieveProjects()}" update="usrProjctsList" />

        <p:selectOneListbox id="usrProjctsList" onchange="jsfElmnt('#{cc.clientId}:selUsrProjct').val($(this).val());">
            <f:selectItems value="#{pim.projects}" var="project" itemLabel="#{project.title}" itemValue="#{project.id}"/> 
        </p:selectOneListbox>

        <h:inputHidden id="selUsrProjct" value="#{bean.underProject}"/>

I don't think that the error j_idt153:j_idt159:j_idt184:j_idt194: Validation Error: Value is not valid referring to <p:selectOneListbox id="usrProjctsList" cause its id not present in the j_idt153:j_idt159:j_idt184:j_idt194 id at all... 我不认为错误j_idt153:j_idt159:j_idt184:j_idt194: Validation Error: Value is not valid引用<p:selectOneListbox id="usrProjctsList" j_idt153:j_idt159:j_idt184:j_idt194: Validation Error: Value is not valid导致其id不存在于j_idt153:j_idt159:j_idt184:j_idt194 ID中所有...

do view source in your browser and look for the j_idt153:j_idt159:j_idt184:j_idt194 id and try to find out to whom it belongs 在浏览器中view source并查找j_idt153:j_idt159:j_idt184:j_idt194 id并尝试找出它属于谁

also you can try to add immediate="true" to your <p:ajax to skip validation or try adding <p:ajax to that troublesome component j_idt153:j_idt159:j_idt184:j_idt194 你也可以尝试添加immediate="true"到你的<p:ajax跳过验证或尝试加入<p:ajax到麻烦的组件j_idt153:j_idt159:j_idt184:j_idt194

As Daniel said, the id doesn't match either. 正如Daniel所说,该ID也不匹配。 But for skipping the validation you could also use the process=@this (and other stuff, except the listBox) on your ajax event. 但是,为了跳过验证,您还可以在ajax事件中使用process=@this (and other stuff, except the listBox) Since you are using primefaces this will just process the stuff written there and skip the rest. 由于您使用的是素数,这只会处理此处写的内容,而忽略其余内容。

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

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