-
1. Re: Seam field validation with no model update
binnyg Jun 18, 2009 10:32 PM (in response to pmurphy.pjmurphy.paddypower.com)On your a4j:commandButton
bypassUpdates="true"
-
2. Re: Seam field validation with no model update
binnyg Jun 18, 2009 10:42 PM (in response to pmurphy.pjmurphy.paddypower.com)My bad. I should have read the whole post :(
I have a similar use case and I used hibernate validator to validate my start time. I do not have jsf converter. It works for me.
-
3. Re: Seam field validation with no model update
pmurphy.pjmurphy.paddypower.com Jun 19, 2009 11:00 AM (in response to pmurphy.pjmurphy.paddypower.com)Hi Binesh,
Thanks for the reply. So you think that the f:convertDateTime is interfering with the behaviour of the field? Seams a bit weird that a built in converter is causing the field to revert back to it's original value. Could this be considered a bug?
Thanks,
Philip
-
4. Re: Seam field validation with no model update
pmurphy.pjmurphy.paddypower.com Jun 19, 2009 4:01 PM (in response to pmurphy.pjmurphy.paddypower.com)BTW, I can't change the validation rule on the entity as the entity will be used by different systems that require different date patterns etc. i.e. I have to keep the yyyy-MM-dd HH:mm:ss date pattern at the JSF level. Therefore I can't use your suggestion. If anyone else has any other solutions please post.
-
5. Re: Seam field validation with no model update
binnyg Jun 19, 2009 7:00 PM (in response to pmurphy.pjmurphy.paddypower.com)I modified my code and tested it with f:convertDateTime and it works as expected. The only change is, I do not have is the timezone. All 4 steps works for me. So, this is not a bug. How is your event object populated? what is the scope of the event ?
-
6. Re: Seam field validation with no model update
pmurphy.pjmurphy.paddypower.com Jun 19, 2009 8:52 PM (in response to pmurphy.pjmurphy.paddypower.com)Hi Binesh,
Thanks for taking the time to test if this is working. Note that the original JSF snippet that I sent is wrapped within a a4j:repeat. Details follow of my set up.
Cheers,
Philip
Entity Class
@Entity @Table(name = "event") public class Event implements java.io.Serializable { . . . }
Backing Bean
@Stateful @Name("myAction") @Scope(ScopeType.SESSION) public class MyActionImpl implements MyAction { @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager entityManager; @DataModel("myAction_events") private List<Event> events; public void searchEvents() { entityManager.createQuery("SELECT e FROM Event e"); events = (List<Event>) q.getResultList(); } }
JSF
<a4j:repeat value="#{myAction_events}" var="_event"> <a4j:form> <s:decorate id="startTimeDecorate" template="edit.xhtml"> <ui:define name="label">Start Time</ui:define> <h:inputText id="startTime" required="true" value="#{_event.startTime}"> <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="#{myAction.timeZone}" /> <a4j:support event="onblur" reRender="startTimeDecorate" bypassUpdates="true" ajaxSingle="true" /> </h:inputText> </s:decorate> <a4j:commandButton id="updateEvent" value="Update Event" reRender="startTimeHeader" /> </a4j:form> </a4j:repeat>
-
7. Re: Seam field validation with no model update
mpevec Oct 16, 2010 8:08 AM (in response to pmurphy.pjmurphy.paddypower.com)Hi Philip,
did you find a solution of above problem? I have the same problem and i think that a:repeat has something to do with it, look at:
The solution is using bypassUpdates to false,but this canbe very dangerous...
Thanks
Milan