Skip to content

Add a way to change value of widget form components via the AiScript API #16090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
bunnybeam opened this issue May 23, 2025 · 0 comments
Open
1 task
Labels
✨Feature This adds/improves/enhances a feature

Comments

@bunnybeam
Copy link

Summary

Currently, the values of widget form components can (usually) only be changed by a user, not by AiScript code.

For some components, such as textInput, calling .update({default: <new value>}) will change the value. However, this does not work for some other components, such as select, and it seems to be an un-intentional side-effect of setting the default value, rather than an intentional feature.

It would be nice to have an intentional method to set the value of the component at runtime, such as .update({value: <new value>}).

Purpose

Example 1: My widget uses a Ui:C:textInput component. When a button is pressed, I want to clear the text from the component, allowing the user to input new text easily. I can currently do this by changing default with .update(), but this behavior is undocumented, and likely unintended. Adding a new method to do this would help widget developers by giving a clear, documented method to change values at runtime.

Example 2: My widget uses a Ui:C:select component. When a button is pressed, the items in the select component are updated programmatically using .update({items: [...]}). However, there is no way to automatically select one of the new items. The component continues to display the currently selected item, even though that item no longer exists. If there were a way to set the selected value programmatically, this would allow the widget to select an item from the new list to display.

Do you want to implement this feature yourself?

  • Yes, I will implement this by myself and send a pull request
@bunnybeam bunnybeam added the ✨Feature This adds/improves/enhances a feature label May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feature This adds/improves/enhances a feature
Projects
Development

No branches or pull requests

1 participant