Is adding a tickbox that does nothing !ifempty bad or clever?
I have a very bespoke system that we will use internally to track payments.
I have开发者_JAVA技巧 an input box, and if the user leaves it blank (Does not know X), it inserts "Awaiting X" into a database instead of the X.
The idea i have to stop the user fill in either variations of NONE or N/A or some random string of text all the time is that they click a tick box "Not known yet?" and it addes 0.4 opacity to it with jQuery or something - therefore leaving it blank.
Is this bad practice or clever mini-validation?
I welcome any clever ideas for this..
On the database side
It is good practice to use null
(not the string 'null'
, but the database concept null). Into a database to signal the fact that there is no data.
So I would advice not to use 'awaiting this or that'
, but just use null
.
In a database you can select these rows like so:
SELECT * FROM table1 WHERE name IS NULL
On the UI side
I like your idea.
Do do hope that if and when I select the editbox, I can just fill something in without having to untick the checkbox by hand.
精彩评论