I want to create a please wait message

In my page I have a command button that triggers some action versus the database.

During this actions occur I want to do something like:

- disable the command button to avoid other clicks;

- display some "please wait" message on a text field linked to a

SessionBean property.

When done a " well done message"

The first problem I meet (maybe I did not understand very well the jsf request lifecycle) is how to disable the button.

I've tryed something like that in the command button action:

...........

this.textArea1.setDisabled(true)

((SessionBeanDb)getBean("SessionBeanDb")).setOutputRequest (" !!! wait !!!");

FacesContext.getCurrentInstance().renderResponse();

.......

...... make db2 requests...........

this.textArea1.setDisabled(false)

it does not work at all, I would like to understand why if someone could please help. I prefere to find this kind of solution if possible.

After that I've tryed wit hjava script solution. I add one more DIV that appears when user clicks the command button. Scenario: when user clicks the button, the JavaScript function is called.

I find the error: Attribute onclick invalid for tag button according to TLD

I do not like very much mixing javaScript with jsf so I prefere the jsf solution if any.

Thank you all very much

Anna

[1402 byte] By [anna75a] at [2007-11-26 18:17:04]
# 1

I add details abound the javascript solutions I've tryed:

<ui:head binding="#{Page5.head1}" id="head1">

<ui:link binding="#{Page5.link1}" id="link1" url="/resources/stylesheet.css"/>

...........

<ui:head>

.......

<script>

function gowait() {

document.getElementById("main").style.visibility="hidden";

document.getElementById("wait").style.visibility="visible";

}

</script>

</ui:head>

<ui:body binding="#{Page5.body1}" id="body1" style="-rave-layout: grid">

<ui:form binding="#{Page5.form1}" id="form1">

<div id="main">

<ui:button action="#{Page5.confermaSel_action}" binding="#{Page5.button1}" id="button1" onclick="gowait()"

style="height: 24px; left: 647px; top: 192px; position: absolute; width: 144px" text="Conferma Selezione"/>

........

</div>

<div id="wait" style="visibility:hidden; position: absolute; top: 0; left: 0">

........

</div>

anna75a at 2007-7-9 5:50:39 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...