It’s quite common to have a form with a checkbox stating ‘Use foo’ immediately followed by a textbox where the user can input the ‘foo value’ he want’s to use. Of course, this textbox is useful only if ‘Use foo’ is checked
I don’t know the best way to deal with this situation :
- Disable the textbox (ie textboxfoo.Enabled=false;)
- Hide it (ie textboxfoo.Visible=false;)
- Let the user input a foo value if he wants to, and ignore the value he entered.
Is there a best practice that I can follow ?
The textbox should be disabled.
If the textbox is hidden, then the visible alteration of the form will make the program less user-friendly. An example of this is the old (very unpopular) disappearing menu items that used to be in Microsoft Office. People don’t want things moving around on their screens. It’s disorienting.
If the user is permitted to input a useless value, then that gives the false impression that entering the value has some effect.