Novell Home

Showing and Hiding Action Buttons from a UserApp ECMA Script

Novell Cool Solutions: Tip
By Rudy Duym

Digg This - Slashdot This

Posted: 27 Jun 2007
 

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.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell