You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Long story short, I have a checkbox that is supposed to map to different integral values - in this case, unchecked is 0, and checked is 7. Does there currently exist a way to do this without any special handling (ie no custom Bind getter/setter to transform the boolean to the correct range)? I thought maybe the value attribute would work like it does in JS, where when checked, it has that value instead of false, but that doesn't seem to be the case.
I think my only option right now is to use attrif and event-change, or to make a custom element just for this purpose, but ideally this would be possible solely from RML.
(As a secondary thing, is there some way to prevent inputs with out of range values from resetting the bound value at menu show time? Right now, I have inputs directly hooked to our cvar system, but if the user specifies a value that falls outside of menu bounds the menu will reset them. Having an 'indeterminate' option for <select> or something would also work, but ideally the behavior would just be that it doesn't try to call the setter if the user hasn't actually changed it, even if the UI representation doesn't have a matching value to pull from and has to clamp it
EDIT 2: I found a workaround for this secondary issue; I simply ignore all setters on document load, and only follow through with them after the document has fully loaded. that seems to work!)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Long story short, I have a checkbox that is supposed to map to different integral values - in this case, unchecked is 0, and checked is 7. Does there currently exist a way to do this without any special handling (ie no custom
Bind
getter/setter to transform the boolean to the correct range)? I thought maybe thevalue
attribute would work like it does in JS, where when checked, it has that value instead of false, but that doesn't seem to be the case.I think my only option right now is to use attrif and event-change, or to make a custom element just for this purpose, but ideally this would be possible solely from RML.
(As a secondary thing, is there some way to prevent inputs with out of range values from resetting the bound value at menu show time? Right now, I have inputs directly hooked to our cvar system, but if the user specifies a value that falls outside of menu bounds the menu will reset them. Having an 'indeterminate' option for
<select>
or something would also work, but ideally the behavior would just be that it doesn't try to call the setter if the user hasn't actually changed it, even if the UI representation doesn't have a matching value to pull from and has to clamp itEDIT 2: I found a workaround for this secondary issue; I simply ignore all setters on document load, and only follow through with them after the document has fully loaded. that seems to work!)
Beta Was this translation helpful? Give feedback.
All reactions