Hi all,
I have a list widget where each list-item has a numeric input.
The list widget is associated with a list and the item variable with an attribute of the current element within the list.
1) I need that the input field shows as blank if the above variable contains a value < 0.
2) In addition I also need that should not be possible for the user to fill the input with a negative number
3) Should instead be possibile to set a blank value (that in the DB will be set as -1)
How can I achieve this?
Hi @Daniele Betti ,
I prepared an .OML for you since it was quite hard to explain everything by comment, please take a look and let me know if this is what you wanted to achieve.
PS: create some temperatures with different values first in the temperatures screen, and then open the home page and check what was done there.
You will notice that in that homepage list, all negative temperatures you entered, will appear as blank in the input fields, and if you click save all, and go back to the temperatures list, you see that saving as blank will save them with -1 in DB (your equivalent to NULL). Also, if you try to save temperatures with negative values you will receive an error (your validation).
Let me know if this helped!
Paulo
Hi,
If I understood correctly the negative values will show as empty, you say so in point 1).
But in point 3) you're also saying that if you save the input fields as empty, will be saved as -1 in DB, so you are aware that previous negative values will be lost and will all be saved as -1 in DB right? Or is this something you do not want. I just need to better understand the requirement
Cheers,
Let me explain what I understood from your question.
In
1- If any attribute holding negative value then it should show blank in input.
2. User should not be able to enter negative value in input.
If this is correct so now i have query there, if you are restricting user to enter negative value then how it's possible that your table will have negative value.
Regards,
Arun
Ok sorry ;-) I better explain my case.
I only need a way to store/visualize NULL values. I know that it is not a concept of OS so I thought, given that all valid values are >= 0, would be a good idea to:
1) default all values with "-1"
2) if the variable holds a "-1" than show a blank value within the input
3) if the user fills the input with a blank value (e.g. deleting a previuosly entered value) store "-1" in the DB
In addition I need to validate the values (all >=0 as I said), but this is not a problem.
The complexity for me is that I need to manage this case within list items, where I have those input fields and I don't know how to force them to show a blank value in case of -1.
Hoping I made me more clear!
If you want to show blank value when variable holds -1 so i would suggest use input widget with text type instead of number.
If you use input with text so before rendering value to list you can make your -1 value as blank on the action where you are preparing your list.
Thanks,
Thank you @Paulo Ritto it is exactly what I was looking for.
Thank you also to all others members that answered really quickly! Great community :-)