• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Typical Validation Issue - Solutions?

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am facing a pretty typical JSF validation issue. I have a list of commandLinks which are Categories. On the right side of the page I have a form with details about the category. You can also use this form to add or update a category.

Obviously, the category name is required. But since it is blank when the page loads, and if I click on a category link to view the details, I get a validation error. No surprise. So I change the commandLink immediate="true" and, you guessed it, my model isn't updated so most of the details don't get populated in the form.

I've tried many different suggestions that I found on various different sites. I am not interested in adding yet another dependency to this project as in a 3rd party validation library. But I would like to know what other people did to solve this similar issue, if they solved it.

Thanks.
 
Saloon Keeper
Posts: 28133
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems like what you'd want to do is disable the links that aren't yet meaningful. That's just a simple boolean test.

It's what I do, anyway.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, all the links need to be enabled. At any point on the page, the user needs to be able to click a Category link and see the details.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For now what I've done is resorted to doing manaul validation in my action methods.
 
Destroy anything that stands in your way. Except this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic