本文介绍了ignoreValidationFailed在ui:repeat中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用o:ignoreValidationFailed,但是在ui:repeat内部不起作用.当我在外面做同样的事情时,它起作用了!我尝试使用mojarra ans MyFaces ...我使用的是primefaces.如果还有另一种方法可以仅跳过一个按钮的验证...

I´m using o:ignoreValidationFailed, but it doesn´t work inside the ui:repeat. When I do the same outside, it works! I tried with mojarra ans MyFaces... I´m using primefaces. If there is another way to skip the validations only for one button...

 <o:form id="rateplanEditByPeriod" prependId="false">
 <p><p:messages id="mensagensDlg"/></p>

    <p:tabView id="tabs">
   <p:tab title="Cancelamento" id="tabCanc">
   <h:panelGrid id="cancelationsTable" columns="2" cellpadding="10px" columnClasses="alignTop,alignTop">

    <ui:repeat id="repeat" var="rest" value="#{rateplanByPeriodManaged.rateplanByPeriod.restriction.restTypeCancelation.restTypeCanConfs}"  >

                                        <h:panelGrid columns="8">

                                                <p:inputText id="penaltyValue_#{loop.index}" value="#{rest.penalityValue}" style="width:28px" label="Valor" title="Valor"  disabled="#{rest.noCancel}" required="true"/>


                                                <p:commandLink id="add_#{loop.index}" actionListener="#{rateplanByPeriodManaged.addCancConf}" update=":rateplanEditByPeriod:tabs:cancelationsTable" partialSubmit="true" process=":rateplanEditByPeriod:tabs:cancelationsTable" value="+">
                                                <o:ignoreValidationFailed />
                                                </p:commandLink>
                                                <p:commandLink actionListener="#{rateplanByPeriodManaged.removeCancConf(rest)}" value="-" update=":rateplanEditByPeriod:tabs:cancelationsTable" partialSubmit="true" process=":rateplanEditByPeriod:tabs:cancelationsTable">

                                                    <o:ignoreValidationFailed />
                                                </p:commandLink>



                                        </h:panelGrid>

                                    </ui:repeat>


                                </h:panelGrid>

                            </p:tab>

                        </p:tabView>

                        <p:commandLink styleClass="button" onclick="dlgEdit.hide()" immediate="true" update=":msgsPanel">#{msgs['inventory.editByPeriod.cancel']}</p:commandLink>
                        <p:commandLink styleClass="button" actionListener="#{rateplanByPeriodManaged.editByPeriod(loginManaged.hotelSelected)}" oncomplete="if (!args.validationFailed) {dlgEdit.hide(); updateAllSearches(); updateAllNotifications();}" update="mensagensDlg, tabs" >#{msgs['inventory.editByPeriod.confirm']}</p:commandLink>


        </o:form>

推荐答案

我遇到了相同的问题,但是使用了p:datatable我用

I have faced the same issue but with p:datatableI solved it with

1-将条件添加到必填字段,以了解ajax是否来自提交"按钮如@Camilla所说.

1- add a condition to the required field to know if the ajax come from submit button or notas @Camilla said.

required="#{!empty param['trans_desc_form:savetransid']}"/>

trans_desc_form是整个表单ID,而savetransid是提交按钮的保存ID

trans_desc_form is the entire form id and savetransid is the submit button save id

2-我从JPA实体中删除了@NotNull,从而强制了验证

2- I removed @NotNull from my JPA entity which force the validation

@JoinColumn(name = "ITEMNO", referencedColumnName = "ITEMNO")
@ManyToOne(optional = false, fetch = FetchType.LAZY)
//@NotNull
private Item item;

我为此问题创建了一个问题 ignoreValidationFailed在p:dataTable内部不起作用

I have created a question for this issueignoreValidationFailed doesn´t work inside p:dataTable

这篇关于ignoreValidationFailed在ui:repeat中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:28