We have several screen's that execute BAPI calls to CRM to update data. When a user clicks an "Update" button, I would like a way to set that button to disabled until the operation completes. I was thinking that we could use the setOnClientClick method to add JavaScript that would set disabled=true. As it turns out, this does not work because the Button class actually seems to represent an HTML anchor, not an actual button. I tried doing a call in the method that handles the update to get the button component by name and set.Enabled(false). This did not work because I can not force a screen redraw. Any help would be greatly appreciated. This question is VERY high priority for us and we are running out of time to find a solution.
To be complete - we are running EP6 SP2. All of our development is based on Java DynPages (no JSP) and HTMLB.
-Matt
Message was edited by: Matthew Allen
The following code shows how to use client side scripting with HTMLB in order to avoid subsequent "submits" of a form by clicking a button more than once.
It does so by setting a flag after a button was clicked. On each subsequent click the script checks whether or not the form was already submitted and cancels the submit accordingly. In contrast to disabling a button this solution has the benefit that one can avoid the submit of this form from any other control as well (e.g. by another button) since the flag can be checked from everywhere.
HTMLFragment html = new HTMLFragment("<script>var xxxSubmit=true;</script>");
myForm.addComponent(html);
Button myButton = new Button("myButton", "click me!");
myButton.setOnClick("onButtonClick");
myButton.setOnClientClick(
"if(xxxSubmit==true)
{
xxxSubmit=false;
return true;
}
else
{
htmlbevent.cancelSubmit=true;
return false;}
");
myForm.addComponent(myButton);
Add a comment