0

On my html form I want to emulate the idea of a Flags Enum, for example

[Flags]
public enum ColorChannel {
 None = 0,
 Red = 1,
 Green = 2,
 Blue = 4,
 Alpha = 8,
 All = 15
}
Cases:

None => All other options should be deselected.
Any Channel(s) (Not None or All) => None should be deselected.
All Channels => None should be deselected and All should be selected.

Ideally this element would return a number combining all selected values (0 if none, added values if not all and 15 if All are selected).

I've looked into and attempted to write a custom Element in js, but I can't figure out how to integrate this into a form properly or how to style/update relevant values.

0 Answers0