• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue in <a4j:commandLink disable="true" >  RSS feed

 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I currently have a page which uses <a4j:commandLink> and i have it disabled based on some condition , the thing is the link is still clickable(request is not sent though) even when it is disabled ,I think it is an issue with seam (https://issues.jboss.org/browse/RF-4064 ) , and when i observed my generated html page in my browser a href="#" tag is generated , when i manually remove the tag (through firebug) the link is not clickable.Is there any workaround for this ? I am using Seam 2 .

Thanks
Udaya Krishna
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"#" is a marker commonly found in JSF internal href's, so don't put too much emphasis on its ability to manage enabled/disabled controls.

I looked at the issue you mentioned and I'm not sure that's a bug. If you put a commandLink on a page in a form with a control which has "required=true" on it, and there's no data in that required control, JSF's design requires that it reject the commandLink unless the commandLink has "immediate="true"" on it, or you are doing intricate things with AJAX and regions. So they may simply be victim of their own ignorance on how JSF works and no fault in JSF.

You should be able to set CSS values to modify the appearance of a disabled commandLink, and that includes the disabled hover appearance. So if you make the hover and non-hover CSS look the same for disabled state, it should avoid the visual confusion.

Please note that in JSF, changing the enabled state of a control using client-side (javascript) code won't necessarily work the way you wanted to, since the original rendering was done based on what the server interpreted. The only truly reliable way to enable/disable a control in JSF is to tie its "disabled" value to a backing bean property, fire off a server request (AJAX, if you prefer, with partial-page rendering), modify the backing bean's disabled property and let JSF re-render the control according to the updated property value.
 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

Thanks for the response.May be the scenario that i am working on may make this topic clearer.
I have an image below which there is an "Add to Cart" button.The button has a small cart image and is brown in color.As soon as the image is add to cart, the color of the button is turned green and i have a check in the code
So the code works fine with this and clicking on the button does not actually do anything.So I understand from your post that I need to change the CSS such that hover is disabled when the button is disabled?Is that the only way out? please let me know.

Thanks
Udaya Krishna
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. You do realize that because of the JavaBean conventions, that your code example is expecting to find and invoke a function that looks like this, don't you?


Because the first "is" in the accessor method is implicit in having a boolean propertiy.

Also, "return false" in the onclick event on a commandButton or commandLink should be suppressing the submit at the client side, so the server never would be posted.

In fact, if you haven't allowed for these 2 details, the hover UI effects would be explainable by the fact that you weren't truly disabling the button (accessor method not found, so silently assumed returning false) and the button would "act" disabled because you are unconditionally suppressing its effects. Despite which, from a UI internal viewpoint, the button wasn't literally disabled at all. Merely functionally disabled.
 
udaya krishna
Ranch Hand
Posts: 65
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

Because the first "is" in the accessor method is implicit in having a boolean propertiy.
.
Sorry that was a typo , it was basically

So , that still does not answer my question :) or is it that the answer did not change ?

Thanks
Udaya Krishna
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!