Need help to display the prompt box using javascript on web

Hi,

We need a help to build a functionality on lotus notes application using JavaScript. Below gives the brief description of the requirement.

On clicking on the submit button, a prompt box should be displayed with the options along with OK and Cancel buttons. User should be able to select any one option and on clicking OK, the selected value should be stored in the field. On clicking Cancel in the prompt box, prompt box should get closed. The values in the prompt box are dynamic and they cannot be hard coded. Please help how this could be achieved in web form.

Subject: Need help to display the prompt box using javascript on web

This may also help you get started. I had a form where I wanted the admins to be able to select a user to remove from a Business Case and the reason for removal, so there are two questions asked in the prompts in this snippet. My prompt form is called RemoveUser and when I open it I pass it &users=message.message is just a variable that I set earlier in the code and is used to set the options for the list of users that are currently listed on the document, so it is dynamic as the list displayed will be different for each Business Case

Main Form action button

…rest of code

var pathname = (window.location.pathname);

var retval = window.showModalDialog(pathname.substring(0,(pathname.lastIndexOf(‘.nsf’)+5))+‘RemoveUser?OpenForm&users=’ + message,“” ,“dialogWidth: 630px;dialogHeight: 480px;status: yes;unadorned: yes;scroll: yes;help: no;resizable: yes;”);

…rest of code

The retval variable is set by window.returnValue in the second OK button. I had two return values seperated by a newline character so I split on the newlines and then had two values that I could set fields to in the Main form

RemoveUser Form

OK Button 1 - user variable is a global so value is set in first OK button and retrieved in second OK button

var f = document.forms[0];

var selection = false;

var numberselected = 0;

var chosen = 0;

for (i = 0; i < f.UserList.length; i++)

{

    if (f.UserList.options[i].selected == true)

    {

            //one option must be selected or error message displayed

            selection = true;

            //field is set to multi value for display purposes but only one user can be selected

            numberselected++;

            //store option selected which will be returned to parent window

            chosen = i;

    }

}

if (selection == false)

{

    alert ("Please select the user to remove from the Business Case");

    f.UserList.focus();

    return;

}

if (numberselected > 1) {

    alert ("You can only select one user to remove from the Business Case");

    f.UserList.focus();

    return;

}

document.getElementById(“selectuser”).style.display = “none”;

document.getElementById(“selectreason”).style.display = “block”;

user = f.UserList[chosen].text;

OK Button 2

var f = document.forms[0];

var selection = false;

var chosen = 0;

for (i = 0; i < f.Reason.length; i++)

{

    if (f.Reason[i].checked == true)

    {

            //one option must be selected or error message displayed

            selection = true;

            //store option selected which will be returned to parent window

            chosen = i;

    }

}

if (selection == false)

{

    alert ("Please select the reason for removing from the Business Case");

    f.Reasonfocus();

    return;

}

window.returnValue = user + “\n” + f.Reason[chosen].value;

window.close();

Subject: A quick google search found this

http://searchdomino.techtarget.com/tip/Web-Version-Of-PromptOkcancellist

Should be a good starting point for you.