ajax call not working

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
3bu1
Posts: 6
Joined: 30 Dec 2014, 08:31

26 Sep 2016, 14:51

Hi all, I am trying to import omega theme in to my current existing project. In my previous project all the actions where ajax, without page refresh. Now i have this problem for any action page is refreshing...Only few are working like dropdown request etc.Below is the code . Any help would be appriciated.Thanks in advance.

Xhtml code:

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	template="/WEB-INF/template.xhtml">


	<ui:define name="title">
	Patient Payment
</ui:define>


	<ui:define name="implementation">

		<div class="ui-fluid">
			<div class="ui-g">
				<div class="ui-g-12">
				<h:form id="form" enctype="multipart/form-data">
					<div class="card">
						<h1>Patient Payment</h1>
						
							<p:growl id="msgs" showDetail="true" />
						 <p:toolbar style="background: none ; border: none;"> 
                                <f:facet name="right">
							 <p:selectOneMenu id="patients"
							value="#{registrationBean.selectedPatientIdForOrderPayment}"
							filter="true" filterMatchMode="contains"
							valueChangeListener="#{registrationBean.changePatientForOrderPayment}" rendered="#{dashboardBean.getPageEdit()}">

							<f:selectItem itemLabel="Select Patient" itemValue=""	noSelectionOption="true" />
							<f:selectItems value="#{registrationBean.patients}" var="p"
								itemLabel="#{p.patientId} -#{p.firstName} #{p.lastName} - #{p.mobileNo}"
								itemValue="#{p.patientId}" />
							<p:ajax event="change" update="@form" />
							</p:selectOneMenu>
							 
							</f:facet></p:toolbar>
							<p:fieldset legend="Personal Information"
								rendered="#{dashboardBean.getPageSave() or dashboardBean.getPageView()}">
								<p:panelGrid id="patientpanel" columns="4" 
								columnClasses="ui-grid-col-2,ui-grid-col-4,ui-grid-col-2,ui-grid-col-4" 
								layout="grid" styleClass="ui-panelgrid-blank"
								 style="border:0px none; background-color:transparent;"
									rendered="#{dashboardBean.getPageSave() or dashboardBean.getPageView()}">


										<p:outputLabel styleClass="patientRegLabel" value="First Name"></p:outputLabel>
						<p:inputText
							value="#{registrationBean.orderPaymentPatient.firstName}" disabled="true"
							required="true" requiredMessage="Firstname is mandatory"
							validatorMessage="First name should allow only alphabets" placeholder="First Name">
							<f:validateRegex pattern="^[a-zA-Z ]+$" />
	
						</p:inputText>
	
						<p:outputLabel styleClass="patientRegLabel" value="Last Name">
						</p:outputLabel>
						<p:inputText
							value="#{registrationBean.orderPaymentPatient.lastName}" disabled="true"
							required="true" requiredMessage="Lastname is mandatory"
							validatorMessage="Last name should allow only alphabets" placeholder="Last Name">
							<f:validateRegex pattern="^[a-zA-Z ]+$" />
						</p:inputText>
	
						<p:outputLabel styleClass="patientRegLabel" value="Gender" />
						<p:selectOneMenu disabled="true" styleClass="select-patientRegLabel"
							value="#{registrationBean.orderPaymentPatient.gender}">
							<f:selectItem itemLabel="Select" itemValue="0" />
							<f:selectItems value="#{loginBean.gender}" var="ref"
								itemLabel="#{ref.name}" itemValue="#{ref.id}" />
						</p:selectOneMenu>
	
						<p:outputLabel styleClass="patientRegLabel" value="Age" />
						<p:panelGrid id="age" styleClass="agePanel" columns="3" >
							<p:inputText id="year" disabled="true"
								value="#{registrationBean.orderPaymentPatient.years}">
								<p:ajax event="keyup" listener="#{registrationBean.enteredYears}"
									process="@this" update=":form:dateOfBirth" />
							</p:inputText>
							<p:inputText id="month" disabled="true"
								value="#{registrationBean.orderPaymentPatient.months}">
								<p:ajax event="keyup" listener="#{registrationBean.enteredYears}"
									process="@this" update=":form:dateOfBirth" />
							</p:inputText>
							<p:inputText id="day" disabled="true"
								value="#{registrationBean.orderPaymentPatient.days}">
								<p:ajax event="keyup" listener="#{registrationBean.enteredYears}"
									process="@this" update=":form:dateOfBirth" />
							</p:inputText>
						</p:panelGrid>
	
						<p:outputLabel styleClass="patientRegLabel" value="Date Of Birth">
						</p:outputLabel>
						<p:calendar id="dateOfBirth" styleClass="patientDOB" disabled="true"
							value="#{registrationBean.orderPaymentPatient.dob}"
							required="true" requiredMessage="DOB is mandatory"
							navigator="true" pattern="dd/MM/yyyy" mode="popup" showOn="button" placeholder="DD/MM/YYYY">
							<p:ajax event="dateSelect"
								listener="#{registrationBean.onDateSelect}" process="@this"
								update=":form:age" />
						</p:calendar>
	
	
						<p:outputLabel styleClass="patientRegLabel" id="emailMand"  value="Email ID">
						</p:outputLabel>
						<p:inputText id="email" disabled="true"
							value="#{registrationBean.orderPaymentPatient.emailId}"
							required="#{registrationBean.orderPaymentPatient.reportToEmail or registrationBean.orderPaymentPatient.createUser}"
							requiredMessage="Email is mandatory" placeholder="Email Address"
							validatorMessage="Invalid Email format">
							<f:validateRegex
								pattern="([\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.(com|net|org|edu))?" />
	
						</p:inputText>
	
						<p:outputLabel styleClass="patientRegLabel" value="Mobile">
						</p:outputLabel>
						<p:inputText
							value="#{registrationBean.orderPaymentPatient.mobileNo}" disabled="true"
							required="true" requiredMessage="Mobile is mandatory"
							validatorMessage="Mobile should allow 10 digits only" placeholder="Mobile (10 digits)">
							<f:validateRegex pattern="^([+]?[\d]{10}+)?$" />
						</p:inputText>
	
						<p:outputLabel styleClass="patientRegLabel" value="Blood Group" />
						<p:selectOneMenu disabled="true" styleClass="select-patientRegLabel"
							value="#{registrationBean.orderPaymentPatient.bloodGroup}">
							<f:selectItem itemLabel="Select" itemValue="0" />
							<f:selectItems value="#{loginBean.bloodGroups}" var="ref"
								itemLabel="#{ref.name}" itemValue="#{ref.id}" />
						</p:selectOneMenu>
	
						<p:outputLabel styleClass="patientRegLabel" value="Report To Email" />
						<p:selectBooleanCheckbox styleClass="reportEmailCheck" disabled="true"
							value="#{registrationBean.orderPaymentPatient.reportToEmail}">
							<p:ajax update="emailMand" />
						</p:selectBooleanCheckbox>
						
						
						
						
	
	
						<p:outputLabel styleClass="patientRegLabel" value="Doctor" />
						<p:inputText placeholder="Ref. Doctor Name" disabled="true"
							value="#{registrationBean.orderPaymentPatient.doctor}" />
	
						<p:outputLabel styleClass="patientRegLabel" value="Source" />
						<p:selectOneMenu styleClass="select-patientRegLabel" disabled="true"
							value="#{registrationBean.orderPaymentPatient.source}">
							<f:selectItem itemLabel="Select" itemValue="0" />
							<f:selectItems value="#{loginBean.sources}" var="ref"
								itemLabel="#{ref.name}" itemValue="#{ref.id}" />
							<p:ajax event="change" update="source1" />
						</p:selectOneMenu>
	
						<p:inputText id="source1" 
							value="#{registrationBean.orderPaymentPatient.sourceInfo}"
							disabled="true" placeholder="Source Information" />
					
								</p:panelGrid>
							</p:fieldset>

							<p:spacer height="20"></p:spacer>
					 <p:toolbar style="background: none ; border: none;"> 
                                <f:facet name="right">
								<p:selectOneMenu id="paymentOrders"		value="#{registrationBean.selectedOrderId}" filter="true"
					filterMatchMode="contains" valueChangeListener="#{registrationBean.changeOrderForPayment}">
					
					<f:selectItem itemLabel="Select Order" itemValue="" noSelectionOption="true" />
					<f:selectItems value="#{registrationBean.openPatientOrders}" var="p" itemLabel="#{p.id} - #{p.orderAmt - p.paidAmt}" itemValue="#{p.id}" />
					<p:ajax event="change" update="@form" />
				</p:selectOneMenu>
								</f:facet></p:toolbar>
							<p:fieldset legend="Ordered Services">
								
								<!-- Patient Orders -->
								<p:dataTable styleClass="selectService" id="selecteServices" reflow="true"
								value="#{registrationBean.selectedPatientOrder.patientServices}" var="service"
								rowIndexVar="rowIndex"
								selection="#{registrationBean.selectedPatientServices}"
								rowKey="#{service.serviceLabData.serviceHeaderData.serviceId}">
			
								<p:column headerText="#" style="width: 20px">
						   			#{rowIndex+1}
						   		</p:column>
								<p:column headerText="Service Name">
									<p:outputLabel
										value="#{service.serviceLabData.serviceHeaderData.serviceName}" />
								</p:column>
								
								<p:column headerText="Price" style="width: 15%; text-align: right">
									<p:outputLabel
										value="Rs. #{service.serviceLabData.serviceHeaderData.charge}" />
								</p:column>
								<p:columnGroup type="footer">
									<p:row>
										<p:column footerText="Total" colspan="2"
											style="text-align:right;"  />
										
										<p:column colspan="1" footerText="Rs. #{registrationBean.selectedPatientOrder.orderAmt}"
											style="text-align:right;"  styleClass="finalPriceTotal" />
									</p:row>
									<p:row>
										<p:column footerText="Paid Amount" colspan="2"
											style="text-align:right;"  />
										
										<p:column colspan="1" footerText="Rs. #{registrationBean.selectedPatientOrder.paidAmt}"
											style="text-align:right;"  styleClass="finalPriceTotal" />
									</p:row>
									<p:row>
										<p:column footerText="Due Amount" colspan="2"
											style="text-align:right;"  />
										
										<p:column colspan="1" footerText="Rs. #{empty registrationBean.selectedPatientOrder ? '' : registrationBean.selectedPatientOrder.orderAmt - registrationBean.selectedPatientOrder.paidAmt}"
											style="text-align:right;"  styleClass="finalPriceTotal" />
									</p:row>
								</p:columnGroup>
								
							</p:dataTable>

							</p:fieldset>

							<p:spacer height="20"></p:spacer>

							<!-- Lab Pending Sample Collection -->
								
								<div align="right">
								<p:commandButton id="addPay" icon="fa fa-plus"
									actionListener="#{registrationBean.addPaymentForOrderPayment}" process="@this"
									update=":form:paymentDT :form:msgs" onstart="PF('loaderDialog').show()"
									onsuccess="PF('loaderDialog').hide()"  style="max-width:30px;"/>	
							<p:commandButton id="delPay" icon="fa fa-minus"
									actionListener="#{registrationBean.deletePayment}"
									process="@this" update=":form:paymentDT :form:msgs"
									disabled="#{empty registrationBean.selectedPayments}"
									onstart="PF('loaderDialog').show()"
									onsuccess="PF('loaderDialog').hide()" style="max-width:30px;"/>
							</div>
								
							<p:fieldset legend="Add Payment Method"
								rendered="#{dashboardBean.getPageSave() or dashboardBean.getPageView()}">
							
								<!-- <p:outputLabel value="Sample Pending"
										rendered="#{dashboardBean.getPageSave() or dashboardBean.getPageView()}" /> -->
								
								<p:dataTable id="paymentDT" value="#{registrationBean.payments}"
							var="pay" selection="#{registrationBean.selectedPayments}"
							rowKey="#{pay.seqId}">
		
							<p:ajax event="rowSelect" update="paymentDT :form:addPay :form:delPay" />
							<p:ajax event="rowUnselect" update="paymentDT :form:addPay :form:delPay" />
							<p:ajax event="rowSelectCheckbox" update="paymentDT :form:addPay :form:delPay" />
							<p:ajax event="rowUnselectCheckbox" update="paymentDT :form:addPay :form:delPay" />
							<p:ajax event="toggleSelect" update="paymentDT :form:addPay :form:delPay" />
		
		
							<p:column selectionMode="multiple" style="width:15px;" />
							<p:column headerText="Payment Mode">
								<p:selectOneMenu id="paymentMode" value="#{pay.dropdownValue}"
									valueChangeListener="#{registrationBean.changePaymentMode}"
									required="true" requiredMessage="payment type required."
									validatorMessage="Payment Mode is mandatory">
									<f:selectItem itemLabel="Select" itemValue="#{null}" />
									<f:selectItems value="#{loginBean.paymentTypes}" var="ref"
										itemLabel="#{ref.name}" itemValue="#{ref.id}@@#{pay.seqId}" />
		
									<p:ajax event="change" immediate="true"
										update="paymentMode paymentDT :form:msgs" />
		
								</p:selectOneMenu>
							</p:column>
							<p:column headerText="Amount">
								<p:inputText value="#{pay.amount}">
									<p:ajax process="@this" />
								</p:inputText>
							</p:column>
						</p:dataTable>
						
							</p:fieldset>
						</div>	
						
						<div class="card" >	
					<div align="right" >
						<p:commandButton icon="fa fa-edit Fs14 White" value="Save"
						actionListener="#{registrationBean.savePatientServiceOrderPayment}"
						onstart="PF('loaderDialog').show()"	onsuccess="PF('loaderDialog').hide()" 
						process="@form"	update="@form" rendered="#{dashboardBean.getPageSave()}" style="max-width:150px;"/>

					<p:commandButton icon="fa fa-edit Fs14 White"  value="Reset"
						actionListener="#{registrationBean.resetPatientRegistration}"
						onstart="PF('loaderDialog').show()"
						onsuccess="PF('loaderDialog').hide()" process="@this"
						update=":form:patientpanel,selecteServices,paymentDT" rendered="#{dashboardBean.getPageEdit()}" style="max-width:150px;"/>
						
						</div>
							
				
					</div>
					</h:form>
				</div>
			</div>
		</div>
	</ui:define>


</ui:composition>
Is there any issue in my code?

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

29 Sep 2016, 16:27

I think this issue isn't a Layout or theme issue. Can you please try it without Omage?

Post Reply

Return to “Omega - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests