we are new to JSF and are struggling with the following problem.
we have a search page, where a user can click on a button to go to a detail page. When arriving on this detail page the selected record is shown correctly.
When the user edits the value, a validator kicks in. The custom validator checks 2 things: -if the record is already in the DB (unique) -if the value is not empty
When the user removes the current value, to an empty string, submits, the validator says the value is not allowed to be empty.
When the user changes back the value to the previous value, and submits, the validator should validate the current value and go back to the search page.
Now the problem is the following: When using:
<h:outputLabel value="Supplier Id" />
<h:outputLabel value="#{flash.keep.supplier.id}" />
everything works. But we would like to hide the id from the user and use a hidden field.
When removing the outputLabel , and using:
<h:inputHidden value="#{flash.keep.supplier.id}" />
our application thinks we are trying to insert a new supplier instead of saving the already existing supplier, with the same name.
We are using JSF 2.0, GlassFish Server 3.1.2 in a NetBeans development environment.
The beans are RequestScoped
The source code is available on: https://bitbucket.org/dasdan20/timereg4wb-web
The views are in : Web/suppliers/search.xhtml Web/suppliers/addedit.xhtml
The beans and backing code in: src/task/SupplierTask.java src/task.validation/SupplierUniqueValidator src/domain/Supplier.java
The DB backend is MySQL: a backup of the DB can be found in: src/MySQLDatabase
Thanks in advance
K & K