Dynamically Change default text in User Input Box

When using the "Prompt for user input" window is there a way to change the default value of a text input field based on the previous dropdown selection?

In the example above the top box is a dropdown and the bottom box is a text input field. I would like for the default value in the text input field to be "value 1" should "option 1" be selected in the dropdown and I would like "value 2" to be the default value if the user selections "option 2" from the dropdown.

Thanks for any help!

Hi, and welcome to the forum!

As the Default Value Text field accept tokenized variables here's a way you could set it up:

Dynamically Change default text in User Input Box.kmmacros (17 KB)
(v11.0.2)

1 Like

Thank you so much for the suggestion! Unfortunately after running on my end I'm not seeing any results. After downloading and running the macro provided the "text" field is blank by default and remains blank no matter what I select.

Also if you press OK and run the macro a second time?


But I am now believing I misread your request. Am I right in now thinking that you'd want the default value in the text field to update as soon as you've selected your option in the dropdown menu?

Sadly I do not believe this is possible. As the Prompt For User Input cannot be ran asynchronously it cannot be updated without 'completing' it by pressing any of the buttons at the bottom. I hope someone will chime in here and prove me wrong, but I believe creating something like a Refresh-button, something like how I've done it below, might be as close as you can get to what you want (without coding it up with HTML or Java within a Custom HTML Prompt).

Dynamically Change default text in User Input Box v1.1 Macro (v11.0.2)

Dynamically Change default text in User Input Box v1.1.kmmacros (19 KB)
(v11.0.2)

EDIT: Updated this macro to a version only utilising local macros, as, unless you need to access the values from another macro, global macros are not necessary for this setup.
If you want to use your original global macros dropdown and time, you can in the change log of this post find the version of the macro that uses these variables.

EDIT2: Realized that the initial setting of the local__dropdown variable should be placed within a Switch, so uploaded an updated version

2 Likes

This is great! The refresh button gets me close enough so thank you so much!

It'd be super cool if the text input field updated as soon as the previous option was selected so if anyone else has an idea I'm all ears but this definitely meets my needs as of now. Thank you!

1 Like