You are not logged in.
Hi
Field1 - type date
Field2 - hidden unless Field1 .... ?
How to check if the field has been completed?
--
GLPI 10.0.7
GLPI-Inventory 1.2.1
Ubuntu Server 20.04 LTS
Offline
Hi
There is no comparison operator to test if a field has been filled or not. I think you may workaround by using the regex operator. Someting like /.+/ which means that there is at least 1 character.
No support with MP - Always run an upgrade task on a testing instance before running it on production! Always backup before any upgrade task!
Offline
Thank You @btry.
I don't know regex, but I've tried with:
/^[0-9]{4}-[0-9]{2}-[0-9]{2}.$/i
Unfortunately it does not work. It did not work with your proposal either
There are a lot of mathematical operators and they are not work predictable for me. Most often I use the "if the field is not empty" option. It is a pity that there is no such thing - just "not empty". At the moment, sometimes it works for me with =/=, sometimes with >, sometimes not at all
--
GLPI 10.0.7
GLPI-Inventory 1.2.1
Ubuntu Server 20.04 LTS
Offline
I did a quick check : regex is not implemented for date / datetime questions. This is why the regexes don't work.
I see in the code that a empty value is replaced with zeros before the comparison. Then you may try to detect an empty date bay comparing it against 0000-00-00. A dateteime should be compared against 0000-00-00 00:00:00.
No support with MP - Always run an upgrade task on a testing instance before running it on production! Always backup before any upgrade task!
Offline
OK thank you for the information.
It would be nice if there was a legible description somewhere what does not work with something. I spent some time testing different expressions :-D Because if an option is available, it probably works
Regards!
--
GLPI 10.0.7
GLPI-Inventory 1.2.1
Ubuntu Server 20.04 LTS
Offline
Hi @btry
Tried with:
= 0000-00-00
=/= 0000-00-00
Unfortunately it doesn't work either.
--
GLPI 10.0.7
GLPI-Inventory 1.2.1
Ubuntu Server 20.04 LTS
Offline
Hi
I checked and found the problem.
Apply this patch and it should work fine: https://github.com/pluginsGLPI/formcrea … 7b3a0a9517
No support with MP - Always run an upgrade task on a testing instance before running it on production! Always backup before any upgrade task!
Offline
Hi btry
I had to clear my browser cache and it works with "=/= 0000-00-00". Thank You
--
GLPI 10.0.7
GLPI-Inventory 1.2.1
Ubuntu Server 20.04 LTS
Offline
Hi
I found the problem. This commit should solve it, and allow the comparison with 0000-00-00
No support with MP - Always run an upgrade task on a testing instance before running it on production! Always backup before any upgrade task!
Offline