Hi Cagatay,
tnx for replay!
So this problem only occurs on Pojo values.
So here is the scenario:
1. I'm creating a new object
2. selecting value from autocomplete
3. save (persist) new object but continue editing
4. focus on autocomplete field
5. leave this field and the value is gone
but before submitting values, if i focus autocomplete field and leave, value remains.
The same problem occurs if I fetch persisted object, then it loses it's value without prior submitting.
And here is part of xhtml page:
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>Ugovori</title>
<link rel="stylesheet" type="text/css" href="skin.css" />
</h:head>
<h:body>
<h:form id="frmContact" prependId="false">
<p:messages id="msg" />
<h:commandButton value="Save " actionListener="#{ContactController.saveAndContinue}"/>
<h:commandButton value="Save and close" action="/index.xhtml" actionListener="#{ContactController.save}"/>
<h:commandButton value="Cancel and close" action="/index.xhtml" immediate="true"
actionListener="#{ContactController.cancel}" />
<p:panel header="Contract" >
<h:panelGrid columns="2">
<h:panelGrid columns="2">
<h:outputLabel value="Phone number:"/>
<p:autoComplete maxResults="5" completeMethod="#{MSISDNCommons.completeMSISDN}"
value="#{ContactController.object.number}" />
<h:outputLabel value="SIM Card:"/>
<p:autoComplete var="sim" forceSelection="true" completeMethod="#{SIMCommons.completeSIM}" maxResults="5"
itemValue="#{sim}" itemLabel="#{sim.serialNr}" value="#{ContactController.object.sim}" />
The first autoComplete works as expected, but second one gives me trouble.
here is alse SIMCommons.completeSIM method (nothing special):
Code: Select all
public List<SIM> completeSIM(String code) {
List<SIM> result = new ArrayList<SIM>();
if (code != null && code.length() > 3) {
for (SIM r : simCommons.getFreeByLastDigits(code)) {
String snr = r.getSerialNr();
String subsnr = snr.substring(snr.length() - 7, snr.length());
if (subsnr.startsWith(code)) {
result.add(r);
}
}
}
return result;
}