• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set disable for p:commandLink with JavaScript?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic