javascript prompt with a dropdown menu

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • In Progress
Below is my code page: What I want to do is, have the prompt show a dropdown of values they can select from, instead of having the user enter any text.

Thanks

(function(){
  var dbid = "bnt8grwvt";
  var dbidTable = dbid;
  var apptoken = "mytoken";
  $.ajaxSetup({data: {apptoken: apptoken}});
  var description= prompt("Enter a brief description of the work done in this session: ", "");
  if (description == null || description == "")  {
  alert("You did not enter a description I will cancel this Time Out.");
  Return;
}
  var promise = $.get(dbidTable, {
    act: "API_EditRecord",
    rid: QBU_rid,
   _fid_7: "Active",
   // _fid_6: "Out"
  }).then(function(xml) {
    console.dirxml(xml);
 $.get() & location.reload(true);
  });
})();
Photo of Micro Dev

Micro Dev

  • 834 Points 500 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,352 Points 20k badge 2x thumb
There are eight examples of using the jQueryUI Dialog Box in this demo:

How To Dialog
https://community.quickbase.com/quickbase/topics/how-to-dialog

The last two examples demonstrate using <select> controls.
Photo of Micro Dev

Micro Dev

  • 834 Points 500 badge 2x thumb
Thanks for the reply Dan!

So I would code something like this?

var description = $("record", xmlDescriptions).map(function(xmlDescriptions) {.......}

Thanks again
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,242 Points 20k badge 2x thumb
I have no idea what that line of code would do in the context of my answer referring you to the How To Dialog post.

My suggestion would be to break the problem down into smaller problems and tackle them in order:

1) Get a static dialog box to appear on button click
2) Make the dialog box display a static list of options
3) Use an AJAX call to dynamically populate the list of options in the dialog box
4) Perform the API_EditRecord action when OK button is clicked in the dialog box