You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently have some types that have nullable values that come from a database.
Let's say it's an id that's either null or not.
Nullable!int othertable_id;
If I want to display an editor to this id, I can do this in diet:
input(type='number', value=othertable_id)
The resulting html code shows value="Nullable.null", which works OK for this integer, but is a bit messy (and technically be interpreted as text in some browsers).
Because there isn't a type that evaluates to false or some value, it's hard to do this in one statement. For example:
However, a nice addition to diet would be to treat a Nullable value that is null as a "false" in terms of erasing the attribute. I don't think this should impact existing code, since you likely have to sanitize something like this with if statements.
I think this can come in handy in a lot of places, since html has many spots where the absence of an attribute means something different than the presence.
The text was updated successfully, but these errors were encountered:
I currently have some types that have nullable values that come from a database.
Let's say it's an id that's either null or not.
If I want to display an editor to this id, I can do this in diet:
The resulting html code shows
value="Nullable.null"
, which works OK for this integer, but is a bit messy (and technically be interpreted as text in some browsers).Because there isn't a type that evaluates to false or some value, it's hard to do this in one statement. For example:
However, a nice addition to diet would be to treat a
Nullable
value that isnull
as a "false" in terms of erasing the attribute. I don't think this should impact existing code, since you likely have to sanitize something like this with if statements.I think this can come in handy in a lot of places, since html has many spots where the absence of an attribute means something different than the presence.
The text was updated successfully, but these errors were encountered: