File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Problem disabling validation with Javascript in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem disabling validation with Javascript in JSF" Watch "Problem disabling validation with Javascript in JSF" New topic

Problem disabling validation with Javascript in JSF

Juan Porras Antonio

Joined: Feb 16, 2010
Posts: 11
Hi forum.
I have a problem with jsf validation.
I need to disable components, this components has JSF validation and I disabled those using javascript. When I do submit, disable components do validation, still I disabled them!.

However, when I disabled component using 'disabled' tag (without javascript), all works fine.
What's wrong?.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I think you may need a little translation help there. The question did not entirely make sense.

However, I think you're having problems because of the differences between JSF disable and JavaScript disable.

JSF disable works on the JSF component. JavaScript cannot directly access the JSF component. It can only access the HTML that got generated by the JSF component, since JSF doesn't get sent to the browser, only the HTML that the JSF causes to be created.

One of the biggest problems I had in this regard was that I couldn't use JavaScript to enable a component that had been disabled using a JSF disabled= attribute. That's because the JSF HTML generator didn't generate the HTML that the JavaScript wanted to notify, since the control was disabled by JSF.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Problem disabling validation with Javascript in JSF
It's not a secret anymore!