Article

Showing and Hiding Action Buttons from a UserApp ECMA Script

Author Info

27 June 2007 - 2:46am
Submitted by: rduym

article
Reads:

1233

Score:
0
0
 
Comments:

0

Problem

A Forum reader recently asked:

"I need an information about the ECMA-Script. Can I (and how should I) show/hide an Action Button (for example Submit, Cancel,..) from ECMA-Script? Does such a method exist?"

And here's the response from Rudy Duym ...

Solution

You can intercept the action that is behind the buttons, but you cannot show/hide buttons like you can with fields.

To intercept the action you do something like the following example. In this example, the submit action is intercepted and the form will be submitted only if the user replies yes:

form.interceptAction("SubmitAction", "around",
  function (invocation) {
    if (confirm( "Are you sure you want to submit ?")) {
      var result = invocation.proceed(); return result;
    }
  }

);

You can block the action when certain conditions are met, to block you do not call the invocation.proceed() function.

That said, you can of course do whatever you want from within Javascript (that is what the form script basically is, with some extra methods thrown into it) - you only have to know the ID of the HTML element on which to operate. But watch out: each command action is duplicated if you use the choice "both" (as opposed to top or bottom) for the action buttons.


Author Info

27 June 2007 - 2:46am
Submitted by: rduym




User Comments

© 2009 Novell, Inc. All Rights Reserved.