Resetting a Select Box #550
|
I have a Dialog component with a Select Box and some other inputs as part of a Form, a fairly standard data entry setup. I want to clear all form values when the Dialog is closed, essentially resetting the form. Resetting a standard input is fairly straightforward via vanilla JS, just by clearing the value attribute, but I can't figure out how to gracefully reset the value of the Select Box component. Clearing the value doesn't work and I've tried simulating a click on the clear button but it looks like the click event is being intercepted. Is there a standard/accepted/preferred way to do this? |
Replies: 1 comment 1 reply
|
Responding to my own question... after some experimentation, I was able to gracefully reset the Select Box by wrapping it in a I'm not sure if this is the intended preferred way of resetting the Select Box -- considering there is no TemplUI component for |
Responding to my own question... after some experimentation, I was able to gracefully reset the Select Box by wrapping it in a
<form>element and including a button withtype="reset". Clicking this button will send a reset event to the Select Box where it gets intercepted and handled appropriately.I'm not sure if this is the intended preferred way of resetting the Select Box -- considering there is no TemplUI component for
<form>-- but it's the only one I could find that works.