I’m trying to ad 00 as a drop down option that represents minutes. Other options are 30, 45 etc.
00 is being saved in database 0. Is this a bug?
The solution mentioned in the following thread is not helping.
Thanks.
I’m trying to ad 00 as a drop down option that represents minutes. Other options are 30, 45 etc.
00 is being saved in database 0. Is this a bug?
The solution mentioned in the following thread is not helping.
Thanks.
@NigelG post this recently: (with minor change)
You create a new data type (“time_table”) which has the values. It will have two fields.
Description : Text
Number : Number
You use the Description in the Drop Down, but then number in the back end.
So the Text might show “00” but actually the number could be 0 and you then use that in your filter.
That helps. Great. Thanks
Another alternative is if you build your menu out of date interval objects, you should have the option of displaying them :formatted as :MM (that’s minutes in two digits).
This would require you to construct date intervals of the correct duration(s) in your database, similar to Nigel’s approach.
I’m not suggesting it’s better to do it this way, just pointing out for anyone who might happen upon this that there is a data type for storing time durations as literal units of time (as opposed to storing an integer or decimal number that you then interpret as some number of minutes, seconds, hours or whatnot.)
new plugin that make life easier when is static
The issue with that approach is that I just want to use Hours and Minutes not the date. That data type requires me to save an entire date.
I just want to compare opening and closing hours of the business with the database. No date is required.
Is there any way around that ?
@Xec as @JohnMark suggested you can use the Air Static Dropdown labels plugin to address this 00 issue.
I’ve actually looked into this 00 issue and its a very beautiful problem
So bubble try to be smart and automatically returns the the dropdown value as numbers if all the entered choices are numbers.
I don’t know their code but they’re using some function to check if all the options are numbers. For example something like !dropDownOptionsList.some(isNaN)
. And if this is true
they return the dropdown value as a number.
Fortunately or unfortunately 00 is treated as a number (javascript treats any 0 prefix digits of a number as a number, e.g. 00023 is a number). So if you do something like
![00,15,30,45].some(isNaN)
it will return true
saying all the values in the array are numbers and therefore makes the dropdown return value as a number. This unfortunately formats 00 as 0.
But assuming one of the options was text, then the dropdown will be considered as returning text. This is why someone said in this post that putting a double quote around one of the values kind of fix it.
The issue with that workaround is that the option with the double quotes will be returned with the quotes so its not really a good fix.
So this is not really a bug as it is by design just that in this particular case the resulting behaviour is unintended.
So obviously the solution here will be a way to tell bubble that hey treat these values as text and not numbers even though i know i’ve entered numbers.
While we await bubble to one day add such an option, here is how you can use the Air Static Dropdown labels to solve your issue.
0 is equal to 00
.00
(and not a number), then add a text input on the page.yourDropdown'value
.Input's value
I’ve setup this example here for you to look at
Yes i know this is too much for such a simple issue but i guess you understand as i’ve explained above why this occurs. That’s why i call it a beatiful problem
Great stuff.
Now it makes sense.
Appreciate your help.
Cheers
This topic was automatically closed after 14 days. New replies are no longer allowed.