Novell Home

Adding UserApp Buttons, with Form Scripts or HTML

Novell Cool Solutions: Tip
By Rudy Duym

Digg This - Slashdot This

Posted: 11 Jul 2007
 

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()


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

© 2014 Novell