h2fuelcell
Member
Hello,
Maybe I am missing something totally simple here on the form configurator.
I am trying to have my select single field dropdown for a digital field have values of YES/NO but save the data as a 1 or 0 int in a tinyint size 1 DB field.
I have tried using the hardcoded list of options (ie. ~YES~NO~) and the following custom formatting functions.
[pre]
function dadabik_yes_no_to_tinyint1($value){
if ($value == "YES")
{return '1';}
else
{return '0';}
}
function dadabik_yes_no_to_tinyint2($value){
if ($value == "YES")
{return 1;}
else
{return 0;}
}
[/pre]
But none of these options work. I usually get database errors writing the wrong type for the field so the custom func is probably not working. I could do a hardcoded list of "~1~0~" but then I will have to convert a lot of incoming data and users will complain.
I would really like to avoid creating a database table to create such a simple drop down.What is the best practice for accomplishing this? Do you have any suggestions?
Thanks in advance.
Maybe I am missing something totally simple here on the form configurator.
I am trying to have my select single field dropdown for a digital field have values of YES/NO but save the data as a 1 or 0 int in a tinyint size 1 DB field.
I have tried using the hardcoded list of options (ie. ~YES~NO~) and the following custom formatting functions.
[pre]
function dadabik_yes_no_to_tinyint1($value){
if ($value == "YES")
{return '1';}
else
{return '0';}
}
function dadabik_yes_no_to_tinyint2($value){
if ($value == "YES")
{return 1;}
else
{return 0;}
}
[/pre]
But none of these options work. I usually get database errors writing the wrong type for the field so the custom func is probably not working. I could do a hardcoded list of "~1~0~" but then I will have to convert a lot of incoming data and users will complain.
I would really like to avoid creating a database table to create such a simple drop down.What is the best practice for accomplishing this? Do you have any suggestions?
Thanks in advance.