This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 15960
    
  19

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