Thursday, July 23, 2015

forms - Is required validation possible on a switch/toggle control?


Scenario


I want to make sure a user has made a selection on a switch input.


On page load it is either on (1 - in image) or off (2 - in image) depending on what state it is set to in the code.




Problems



  1. On submit the input is read as either being on or off (never unselected)

  2. Visually it is not obvious whether the current selection is made by the user or the default state on page load





Solution


To get around the two issues mentioned above, I could change the switch to a couple of radio buttons (3 - in image) That way required validation will fire and also you can visually see no selection has been made by a user.




Alternative Solution?


However, I would like to hear any ideas about solving the two problems mentioned but still retaining the switch control. Is it even possible?




enter image description here




No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...