LISE saving value 0 (zero) not saved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
eus
Forum Members
Forum Members
Posts: 40
Joined: Fri Jan 16, 2009 12:56 pm

LISE saving value 0 (zero) not saved

Post by eus »

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
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: LISE saving value 0 (zero) not saved

Post by Jeff »

If it doesn't store then output 0 as default.

Code: Select all

{if !empty($field->value)}{$field->value}{else}0{/if}
*this is pseudo-code, I haven't look at the template to know how LISE make var available.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: LISE saving value 0 (zero) not saved

Post by Rolf »

In short {$field->value|default:'0'}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
eus
Forum Members
Forum Members
Posts: 40
Joined: Fri Jan 16, 2009 12:56 pm

Re: LISE saving value 0 (zero) not saved

Post by eus »

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.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: LISE saving value 0 (zero) not saved

Post by Jeff »

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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: LISE saving value 0 (zero) not saved

Post by velden »

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.
Post Reply

Return to “Modules/Add-Ons”