Is it possible to open a javascript dialog with an input on it with Retool?

I have a button called "Load from BAN" that when pressed I really just want a javascript dialog to open with a simple input field on it saying "Enter BAN". Is there any way to do that, or do I actually have to create a modal for simple things like this?

You've to create a Modal for it because the JS prompt method doesn't work under the Run Script action.

How do modals work though if I don't want to trigger it from a button? I see that I can do it via control component and that works, but are we just supposed to always physically hide that blue button on the page somewhere? That's what keeps throwing me off as I virtually never want to open it from a button.

You can use a Query on-Success or failure event or a JavaScript Query.

Right, but when you drag a modal to the app canvas it adds a button, and if you delete the button it deletes the modal.

See? That's when you drag a modal onto the canvas.

Why do I need a button on the page if I'm going to be opening the modal by pressing a button?

You can hide this Modal and then handle it via query every time.

  1. Drag a Modal
  2. Set its property hidden true
  3. Open it with a JS or via a control component


Yeah that's what i'm doing. Sure it's "easy", but it's illogical and unnecessary having to hide a button every single time I want to use a different modal.

Hey! This is a pretty commonly requested feature but there currently isn't a timeframe for including it. We can let you know here when there's support for modals without buttons!