File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 15641
    
  15

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?
 
Similar Threads
problems with two divs sitting next to the other.
Problem with iframe in mozilla browser
jsp + html: only this jsp javascript code is not working
HTML page including image at top leaving blank space at top
How to get onclick value from button which is there in hidden div?