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.
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;
5. Enter the following code in the onLoad event:
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

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;

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


7. Make the Window Title = Title

In the form you are going to call the Prompt from, you will need to do the

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

DEFAULT ReturnValue:="";

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

dspDialog("PromptOKCancelList", 250, 175,

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 =
idth=" + widthParm + ",width=" + widthParm + ",innerheight=" + heightParm
+ ",height=" + heightParm + ",dependent=yes,resizable=yes";
newWindow = window.open(winURL, winName, winOpts);

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.