Hello,
Is it possible to store the value 0 (it's the text_input field).?
I think it's something in the core. I want to use it for a module where i can store a team result.
"0 will work, so i can strip it in the frontend but maybe there are other solutions or tricks.
Thnx
LISE saving value 0 (zero) not saved
Re: LISE saving value 0 (zero) not saved
If it doesn't store then output 0 as default.
*this is pseudo-code, I haven't look at the template to know how LISE make var available.
Code: Select all
{if !empty($field->value)}{$field->value}{else}0{/if}Re: LISE saving value 0 (zero) not saved
In short {$field->value|default:'0'}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: LISE saving value 0 (zero) not saved
Thanks for the tips and shortcode.
It will work in many solutions but the field i've got is a "score" field. So it can be 0,1,2,3,4 etc.
The frontend then shows 0 as a score. The admin also doesn't show 0 but blank. I think indeed that 0 will not store in the database.
This is a workaround. Ik can tell the user to fill in "00" instead of "0"
if $field_value == "00" -> "0" in the frontend.
It will work in many solutions but the field i've got is a "score" field. So it can be 0,1,2,3,4 etc.
The frontend then shows 0 as a score. The admin also doesn't show 0 but blank. I think indeed that 0 will not store in the database.
This is a workaround. Ik can tell the user to fill in "00" instead of "0"
if $field_value == "00" -> "0" in the frontend.
Re: LISE saving value 0 (zero) not saved
Check to see if you can put a "default value" when you setup the field?
It isn't an issue with storing in the db, it is possible it is in the security checks when submitting the edit form (it probably checks !empty() ).
Alternatively, you can use custom templates in that Admin to add the "|default:0" as well.
It isn't an issue with storing in the db, it is possible it is in the security checks when submitting the edit form (it probably checks !empty() ).
Alternatively, you can use custom templates in that Admin to add the "|default:0" as well.
Re: LISE saving value 0 (zero) not saved
In my opinion you should try to file a bug report.
'0' should be a valid string. I think we all agree on that.
Filing a bug report informs the developer and he might think of a solution and fix it for next releases.
'0' should be a valid string. I think we all agree on that.
Filing a bug report informs the developer and he might think of a solution and fix it for next releases.



