<p:spinner> max value didn't refresh other value after getting error from validation form.

UI Components for JSF
Post Reply
massive143
Posts: 1
Joined: 13 Feb 2018, 11:34

21 Aug 2019, 06:47

So, it worked fine, until it get error validation. myMaxDuration didn't change in display, but in console it changed.
If, the myMaxDuration I send into bean is high number, more than other value in the list. Ajax worked fine.
But, if myMaxDuration when I send into bean is the smallest number, ajax won't work.

Code: Select all

<p:panelGrid columns="1" columnClasses="ui-grid-col-6" layout="grid" styleClass="ui-panelgrid-blank">
	<p:outputLabel value="Status" styleClass="labelSmall"/>
	<p:selectOneMenu required="true" value="#{myBean.nEmp.employmentStatusID}" 
			<f:selectItems value="#{myBean.listEmploymentStatus}" var="empStat" itemValue="#{empStat.employmentStatusID}" itemLabel="#{empStat.employmentStatusName}">
			</f:selectItems>
		<p:ajax listener="#{myBean.maxDuration()}" update=":form:durasiID"></p:ajax>
	</p:selectOneMenu>
</p:panelGrid>
						
					
	<p:outputPanel>
			<p:panelGrid columns="1" columnClasses="ui-grid-col-3" layout="grid" styleClass="ui-panelgrid-blank" rendered="#{myBean.nEmp.employmentStatusID != 6}">
				<p:outputLabel value="Durasi" styleClass="labelSmall"/>
								
				<p:spinner min="1" max="#{myBean.myMaxDuration}" id="durasiID" value="{myBean.nEmp.monthDuration}"/>
			 </p:panelGrid>
	</p:outputPanel>

Code: Select all

<p:commandButton  widgetVar="saveWid" onclick="PF('saveWid').disable();" oncomplete="PF('saveWid').enable()"  value="save" action="#{myBean.saveNewDecreeEmployee(1)}" />

Code: Select all

	on my bean
	public void maxDuration() {
		myEntity = newEmpRules.duration( nEmp.getEmploymentStatusID());
		myMaxDuration = dur.getMonthDurationMax();
		nEmp.setMonthDuration(myMaxDuration );
	}
anyhelp would be appreciate

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

22 Aug 2019, 14:40


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 57 guests