Article

rduym's picture
article
Reads:

4930

Score:
0
0
 
Comments:

0

Adding UserApp Buttons, with Form Scripts or HTML

Author Info

11 July 2007 - 2:58am
Submitted by: rduym

(View Disclaimer)

Problem

A Forum reader recently asked:

"I would like to spawn an action (update list) based on a user event. I
have been using the 'onChange' of a checkbox, but this is a bit
misleading. Ideally, an HTML button labeled 'Update List' would be best.

My understanding is that I could reverse-engineer the source of the
workflow page and create an HTML button using the HTML Control Type. I
could set up this button to call one of the Javascript functions to update
the list.

Before I start this, I was wondering if anyone has any advice on this
topic, or perhaps and hints on the naming of field, functions, etc."

And here is the response from Rudy Duym ...

Solution

It is possible to use the HTML control to do this. However, there is a form script function that allows you to add a text button or imagebutton to the right of an existing form field.

Use this:

JUICE.UICtrlUtil.addButton(/*JUICE.BaseControl*/ ctrl, name, txt, alt, onClickScript, w, h)

Here's an example of script that you can put in a field event:

 var ctrl = JUICE.UICtrlUtil.getControl(field.getName());
 var btn = JUICE.UICtrlUtil.addButton(ctrl, "mybtn", "A", "tooltip", "javascript:alert(\"clicked A\");");

And here's an example of an in-line anonymous function:

 var ctrl = JUICE.UICtrlUtil.getControl(field.getName());
 var btn1 = JUICE.UICtrlUtil.addButton(ctrl, "mybtn1", "B", "tooltip", function() { alert("clicked B"); } );

Try this out. If you still want to do this with the HTML control, you can paste over the code from the result of a call to JUICE.UICtrlUtil.addButton()


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell