Page 1 of 1

Value List Defined in ini file but shows something else

PostPosted: Wed Jul 21, 2010 1:53 pm
by transcan
When entering the valuelists in the valuelists.ini file, I have data such as 0 or 1, or N or Y mapped a field with No or Yes, and under list view, nothing appears.

When editing or creating a new record, the drop down appears but with a blank/null value as the first selection and the numeral 1 as the second but not No or Yes.

How do I figure out this dilemma.

Thanks in advance.

Re: Value List Defined in ini file but shows something else

PostPosted: Wed Jul 21, 2010 3:02 pm
by cantlep
Are there any errors in your web log files? I'm not 100% but I know the term "OK" can't be used on the left hand side of the "=" sign in valuelist.ini..perhaps there's something similar with using Y and N or 0 and 1. (This is just a guess).

Does it work if you put other things in there like
Code: Select all
NEW = New
OLD = Old
REJ = Rejected


Just to make sure everything is working as it should be? If there is a restriction with Y,N, etc then you culd just create a table in the DB with the values you want and then use this type of thing
Code: Select all
__sql__"=SELECT whatever FROM yourtable ORDER BY whatever"

Re: Value List Defined in ini file but shows something else

PostPosted: Wed Jul 21, 2010 4:49 pm
by shannah
0 is a "reserved word" in INI files so you can't use it as a key in valuelists defined in the INI file. The workaround is to define these sorts of valuelists in the delegate class:
Code: Select all
function valuelist__myvaluelist(){
    return array(0=>'No', 1=>'Yes');
}

Re: Value List Defined in ini file but shows something else

PostPosted: Thu Jul 22, 2010 7:46 am
by transcan
Code: Select all
NEW = New
OLD = Old
REJ = Rejected


By instituting a new list and thus changing in MySQL that particular field from TINYINT or INT to VARCHAR, caused all value lists to cease working.

===

Code: Select all
function valuelist__myvaluelist(){
    return array(0=>'No', 1=>'Yes');
}


This caused that particular drop down list to be blank. I could not make it work.

===
Workaround:

I had to revert the field back to INT, cease using 0, used 1 and higher mapped to words other than Yes or No.

Thanks.