• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set disable for p:commandLink with JavaScript?

 
Andrew Progash
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic