Hi,
I have a radiobox like
0=0
1=1
2=2
3=3
But, when I submit and read de DB, the zero values are in blank, but not the other values. How can i do, to force "0" in DB when the value is zero? and not blank
It's very important for me, because i've to reconvert de blank fields in "0" after and it's very bad.
thanks
Hi gcanavate,
What are the Radio buttons for? I advise that you don't use 0 as a value because of this problem. Can you use zero=0 ?
Bob
Hi, I 'm using a Likert scale in which the user must choose the values of the scale ( from 0 to 6 according to a predetermined scale : strongly disagree to strongly agree) .
I need the number "0" is recorded for calculations. The question is, that the remaining numbers (from 1 if they are recorded , but not zero )
It doesn't works, i'm sorry.
With your code and with another code like this:
<?php
If ( $form->data['p1'] = = 'zero' ) {
$form->data['p1'] = 0;
}
?>
The result is Blank (no data) in the DB.
Some another solution?
Hi gcanavate,
What is the type of the column you are saving to in the database?
Bob
Normally i'm using TEXT, because my table has 220 variables (too long table), but in this case i'm using VARCHAR (the default value).
Maybe, is better to use BOOL?
Hi gcanavate,
Please try INT or TINYINT
BOOL will only allow 0 or 1 and you need 0-6
Bob
does not work. I've tried with INT and TINYINT and don't save "0" value.
German
Hi gcanavate,
Apologies, there were some typos in the code I posted, please check the updated version.
Bob
Hi gcanavate,
By all means PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.
Bob
A VARCHAR with length "3" for example should work, did you try that ? this should store any value passed.
You may also try INT, length 2, default 0
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi gcavanate,
I took a look at the form and used the Table Backup icon to see the data saved, It looks as though the '0's are being saved correctly - it's just that the Data Viewer doesn't display them correctly,
Bob
thank you very much for the interest you have shown. You have been very helpful.