Web Version Of @Prompt([Okcancellist])

I have spent much time looking for a way to do @Prompts on the web. Nothing
really worked the way I wanted it to, so I had to make my own. Hopefully this
posting will help someone else not have to go through that same torture! The
process is involved, but once you've got it, you can re-use it easily.

The code below will open up a prompt box with the different dog types (or
whatever) in it. When a selection is made, the code in the onReset event
executes and displays the UNID of the selection. You can then use that value
to lookup the returned value and do other calculations, if you wish.
STEP ONE: CREATE THE DATA IN THE LIST
----------------------------------------------------------------------
Create a form to hold your keywords. I called mine Keyword Reference. The form
should have the following:

1. Fieldname = Keyword, Type = Text
2. Fieldname = Value, Type = Text
3. Fieldname = DocID, Type = Text, Default Value = @DocumentUniqueID
4. Enter the following code in the JSHeader:
function makeSelection()
{ var dialog=window.document.forms[0];
var launcher=window.opener.document.forms[0];
launcher.ReturnValue.value = dialog.DocID.value;
launcher.reset();
window.close();
}
5. Enter the following code in the onLoad event:
makeSelection()
6. Make the background the same color as your prompt form (see step two below).
7. Hide everything from Web Browsers.
8. Make sure "Generate HTML for all fields" form property is checked.

Create a view for your keyword reference forms. The first column should
contain the Keyword field and should be be sorted and categorized. The second
column should contain the Value field and should be sorted. In the view
properties, disable the "Show selection margin" property.

Create some keyword reference documents. Each document should contain one
keyword value only. For example, if you were going to create a prompt list for
types of dogs, you might create the following keyword reference documents:
Keyword = Dog Types
Value = Poodle

Keyword = Dog Types
Value = Peekapoo

Keyword = Dog Types
Value = Old English Sheep Dog


STEP TWO: CREATE THE PROMPT BOX FORM
---------------------------------------------------------------------------
Create a form that will be your prompt box. I named mine PromptOKCancelList.
It should have the following:

1. Fieldname = Query_String, Type = Text, Default Value = query_string
2. Fieldname = Keyword, Type = Text, Default Value =
val1:=@Right(Query_String; "key=");
val2:=@If(@Contains(val1; "&"); @Left(val1; "&"); val1);
@ReplaceSubstring(val2; "+"; " ")
3. Fieldname = Title, Type = Text, Default Value =
val1:=@Right(Query_String; "title=");
val2:=@If(@Contains(val1; "&"); @Left(val1; "&"); val1);
@ReplaceSubstring(val2; "+"; " ")
4. An embedded view of the view you created above. In the "Show Single
Category" box, enter Keyword.
5. An "OK" button with the following JavaScript code:

var dialog=window.document.forms[0];
var launcher = window.opener.document.forms[0];
applView = document.applets.view;
if (applView != null)
{ // Wait for the view applet to initialize
while (!applView.isActive()) {};
var sDocUNID = applView.getSelectedDocumentsEX();
}
launcher.ReturnValue.value = sDocUNID;
launcher.reset();
window.close();

6. A "Cancel" button with the following JavaScript code:

window.close()

7. Make the Window Title = Title

STEP THREE: PREPARE YOUR FORM
-------------------------------------------------------------
In the form you are going to call the Prompt from, you will need to do the
following:

1. Fieldname = ReturnValue, Type = Text, Default Value =

DEFAULT ReturnValue:="";
ReturnValue

2. Create an action button with the following JavaScript code:

dspDialog("PromptOKCancelList", 250, 175,
"&key=Dog+Types&title=Select+a+Dog+Type");

3. Enter the following code in the JSHeader:

var frm = document.forms[0];
var path = window.location.pathname.toLowerCase();
nsfPos = path.indexOf(".nsf");
path=path.substring(0, nsfPos+5);
function dspDialog ( formName, widthParm, heightParm, optionalParmList)
{
winURL = path + formName + "?OpenForm" + optionalParmList;
winName = "newWindow";
winOpts =
"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,innerw
idth=" + widthParm + ",width=" + widthParm + ",innerheight=" + heightParm
+ ",height=" + heightParm + ",dependent=yes,resizable=yes";
newWindow = window.open(winURL, winName, winOpts);
newWi
This was first published in November 2000

Dig deeper on Domino Resources

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close