This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSf 1.0..Need to disable/enable a button before/after Method execution  RSS feed

 
Ankit Khandelwal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All

I am working with an existing project in which JSF1.0 was used and i have to implement a feature.

There is a button on the screen and when user clicks it, it process some records and after completion of the processing , user gets the successful/failure message on the same screen.

What i need to do is i have to disable the button after click for the time when processing is going on and as soon as control comes back to screen i have to enable that button again.

Please help

 
john wutka
Ranch Hand
Posts: 31
 
Ankit Khandelwal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks John to reply

But the thing is i have to enable that button again.

Below is my code.



Now as par your guidence if i use the method onclick it will diable my button when i click it but how the button will be enabled again. Because i have binded the disabled property through bean.

Please suggest.
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to look into upgrading to at least JSF 1.2. As I recall, it's relatively painless, and it will get rid of some problems that 1.0 had.

When you submit a form, a request gets sent to the server with the form data in it. The request is processed and a response is returned. That response will be an updated copy of the form page, assuming that you didn't navigate to a different page as part of the processing.

Javascript disabling of controls only applies to the current page, so you can safely disable the button and expect that button to be enabled again when the page is updated.

The backing bean property "disabled" is different and you shouldn't attempt to use it for what you want to do. The problem is that that property is a directive to the page renderer, not to the client's current copy of the page.
 
Ankit Khandelwal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wooowwwwwwwwwwwwwww...........

Evrything was theroretical....just got to know don't use disabled property...didn't get how to accomplish my task.

not only that when i tried like



it did not work properly , it was disable the button but not submitting the form.

Any help would be greatly appreciated.

One more thing is it possible that i can disable the whole screen during processing.........
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that if you remove the quote marks from around "true" it may help.

The JSF disabled= and HTML (javascript) disabled= properties are not quite the same thing. The JSF one presets the HTML "disabled" attribute when the form is rendered. The JSF one controls the actual HTML control on the page. That's why I said that using the JSF disabled attribute wouldn't do you any good.

The best way to disable a page is to simply overlay it with a rectangle that covers the page. You can define a div element to do this underneath the page and simply change its Z-order to go on top as part of the submit process. People often make this div semi-transparent, although I'm not sure if that works for IE.
 
Ankit Khandelwal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim

You are right ... I should use true instead of "true".

but my page is not getting submitted using document.getElementById(formId).submit();

Any clue
 
Ankit Khandelwal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me that i am using <h:form> tag which is the cause of failure submit.


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!