New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Column::allows_empty_string() doesn't work as documented #4
Comments
Ah yes, good catch. The idea here is that if a text field allows nulls then it should be set to null if an empty string is passed in. Either that, or the UI should be changed to permit explicit setting of null, vs empty strings. What do you think? |
Can you see if the test at Line 118 in dac0b87
|
Frankly, I think Tabulate being a general use library should allow both NULLs and empty strings for nullable text fields. This is because you can't know beforehand which databases users will manage. In certain scenarios developers might specifically choose to store both empty strings and NULLs meaning different things (e.g. NULL = user never submitted data via some sort of the front end UI, empty = user knowingly submitted/confirmed empty string). The UI might show the checkbox [x] NULL after the input box if the input box is empty (and hide it with javascript once the text box is filled with something). However, I agree that the current approach that you chose still makes perfect sense, provides cleaner UI and will work perfectly in most cases. |
Yes, you are quite correct! I agree, a checkbox allowing either null or empty string is the way to go. I'll get it done. :) |
The following
WordPress\Tabulate\DB\Column
method works contradictionary to how it is documented:Supposedly, it should be
return !$this->nullable() ...
The text was updated successfully, but these errors were encountered: