• 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

getting forceId in h:commandLink

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using an IBM implementation of JSF and need to disable a command button after it is clicked so that the user can't click it again until the page is refreshed. Doing a this.disabled='disabled' in the onClick event doesnt work because once the button is disabled, the submit button wont submit anymore.

So we thought, we'd make the submit button a regular button and put some kind of form.submit in the onClick. So we made a clickLink JS fxn and a commandLink with the appropriate action which would be called by the clickLink fxn. the clickLink fxn would in turn be called on the onClick of the command button.

This idea being taken form this page:
Using Javascript with JSF

Now the problem is that in this example we're using the Tomahawk JSF commandlink.

<t:commandLink id="hiddenLink" forceId="true" action="register" >
<h:outputText value="tester" />
</t:commandLink>

But if I use the <h:commandLink from the ibm implementation that our architect insists on, it doesnt have the "forceId" property. Without that property being there, The button does get disabled but the form doesnt get submitted.

1. Is this is the most optimal approach to achieve what I want (Disable cmd button after one click, yet submit form)
2. Is it possible to use the regular implementation of commandLink instead of the Tomahawk one and still achieve the same objective?
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the standard to achieve this.

As you have done have a commandButton as:



Then create a hidden comand link that calls an action on your backing bean that processes the form:



Then add script to disable the submit button and click on the link.



Hope this helps.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks a lot!!! It helped me a lot.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic