aspose file tools*
The moose likes JSF and the fly likes How to set disable for p:commandLink with JavaScript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to set disable for p:commandLink with JavaScript?" Watch "How to set disable for p:commandLink with JavaScript?" New topic
Author

How to set disable for p:commandLink with JavaScript?

Andrew Progash
Greenhorn

Joined: Jul 16, 2013
Posts: 4
How to set disable for p:commandLink with JavaScript?

If don't tick the box, I will not allow click button and redirect to other page.
I try to set disable by the following:


but not successful.

Thank you.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

First, I recommend not using raw HTML in JSF View definitions. Instead of a TABLE and its elements, use an h:panelGrid. It's usually less coding, it integrates better with JSF, and you only have to work in one language instead of two.

Secondly, manipulation of the "rendered", "disabled" and "readonly" attributes of JSF controls can be tricky, because the JSF renderer may not have included all of the items you require in order to reliably toggle their values.

You are better off attaching an AJAX event to the checkbox with a "render" option that updates the b1 control. Make the b1 control's "disabled" attribute a backing bean property reference (EL expression), and make the AJAX server-side code flip that "disabled" property's value.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set disable for p:commandLink with JavaScript?