Advertisement

07.02.2008 at 08:16AM PDT, ID: 23533878
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

how do i do jsf validation comparing 2 date fields in a table row ONLY when the table row checkbox has been selected

Asked by cavtel in Enterprise Java Beans (EJB), J2EE, Java Server Faces (JSF)

Tags: ,

A little background information..

    technologies : JSF -> entityManager (stateless / detached) -> entity classes -> oracle
      * using hibernate 3.x for the entityManager and entityclasses / annotations

    i have an entity class mapped to an oracle table
        RATES(ID NUMBER, START_DATE DATE, END_DATE DATE)

        there is a check constraint on RATES

        CONSTRAINT CK_MRC_RATES
        CHECK (EFFECTIVE_END_DATE > EFFECTIVE_START_DATE)
        DEFERRABLE INITIALLY DEFERRED

   the jsf application has a jsf table with muliple rows.  

    there are 3 fields in each row : CheckBox, startDate (static Text), endDate (textBox)

    the application allows a user to update the endDate on as many rows as they want, but they do need to select the checkbox if the date is to be processed.

    I have a jsf message component in the endDate cell and the message is tied to the endDate.  I do have a DateTime converter on the endDate with a MM/dd/yyyy pattern and if the user enters a date that is invalid the endDate message displays the error just fine to the.

My real question ...

    i want to enforce endDate > startDate without using javascript  on (checkbox) selected rows.  I also want the error of 'End Date must be greater then Start Date' to appear in the message component only for the rows in question.

What i've figured out so far ...

  I can't use custom JSF validation because the validation fires before the checkbox binding occurs and I can't tell if a row has been selected through a TableSelectPhaseListener.

    the Hibernate validation package could probably work but the overhead to have the error appear in the 'proper' cell  / row seems very high.

    capturing the oracle constraint violation has the same problem as trying to deal with hibernate validations.  it's actually i little more wonky in that a SQLException is not thrown and i need to parse the stack trace to find the oracle error.

any help is appreciated.  maybe javascript is the easy answer .. i don't knowStart Free Trial
[+][-]07.05.2008 at 11:18AM PDT, ID: 21937860

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2008 at 08:36AM PDT, ID: 21945979

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Enterprise Java Beans (EJB), J2EE, Java Server Faces (JSF)
Tags: java , JSF, HIBERNATE, JAVASCRIPT, data validation
Sign Up Now!
Solution Provided By: cavtel
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628