valuelists not working

A place for users and developers of the Xataface to discuss and receive support.

Postby dst01 » Mon Jun 05, 2006 12:41 pm

Hi first thanks for a great appliaction!

Now i went over all my settings and i still cannot make the valuelists work? I have my fields.ini file configured as well as my valuelists.ini file. Below is the content of both were they are stored in /var/www/html/sysadminappl/tables/apps
[root@localhost apps]# ls
fields.ini valuelists.ini

here is valuelists.ini
[list]
APP1 = Application1
APP2 = Application2
APP3 = Application3

here is fields.ini
[Applications]
widget:type = select
vocabulary = list
dst01
 
Posts: 9
Joined: Wed Dec 31, 1969 5:00 pm

Postby njw » Mon Jun 05, 2006 1:25 pm

Have you tried using a different valuelist name than "list"? "List" could easily be a reserved word - try "Apps" or "qwerty" or something.

Neil
njw
 
Posts: 280
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Jun 05, 2006 2:40 pm

Good idea to try Neil's suggestion about the name. I can't think of any reason why the name 'list' would be a problem, but this would be a good thing to try.

Alternatively, some questions:

1. I'm assuming that the name of your table is 'apps'. Correct?
2. The field in the 'apps' table is named 'Applications'. Correct? (Case sensitive).

Last thing I can think of is make sure that both your valuelists.ini and fields.ini files are readable by the webserver (i.e. make sure they are at least 0644).

Also double check to make sure that your fields.ini file is getting picked up. Try changing the labels on some fields to make sure that that works.

Hope this helps.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby dst01 » Tue Jun 06, 2006 9:16 am

njw,

yes i tried names other than list.

Steve,

1. yes my table is called apps.
2. yes the field is Applications correct.

i went over everything so many times, there must be an error somewhere. I have since created another db and followed your guide for the Program and Courses etc and that valuelist works, so it not a webserver readable issue.

let me compare and i will get back here.
dst01
 
Posts: 9
Joined: Wed Dec 31, 1969 5:00 pm

Postby dleffler » Tue Jun 06, 2006 5:44 pm

It appears that things break in Table.php in line 716 (for me anyway). I haven't been able to track down WHY it defaults to "__import__" as if the list is coming straight from a table since it should default to the last else clause.
dleffler
 
Posts: 1
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Jun 06, 2006 7:51 pm

This is very strange. That would indicate that you have an entry in your valuelists.ini file for '__import__'.

What version of PHP are you running?

A fix that should not be necessary is to use absolute equality. i.e. Change the '==' to '==='.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby dleffler » Tue Jun 06, 2006 8:40 pm

PHP 4.3.10 Actually, it was as simple as

vocabulary = YesNo

[YesNo]
0 = No
1 = Yes

I would get a for...each error printed at the top of the page for every list I had and the actual list would only have the "Please Select" and "Yes" as options.

I've since created a YesNo table and do a __sql__ since I get the same error with __import__ (not sure how it works anyway without documentation)
dleffler
 
Posts: 1
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Jun 06, 2006 9:07 pm

OK.. this is quite strange. I'm inclined to think that there may be a problem with your PHP install. If you post your fields.ini file and valuelists.ini file I can take a look though to see if anything sticks out. Also if you want to see what's going on, try adding a print_r inside the if statement to see what data it's choking on. e.g.:

Code: Select all
if ( $key == '__import__' ){


becomes

Code: Select all
if ( $key == '__import__' ){
  print_r($vllist);


and let me know what the output is.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby dst01 » Thu Jun 08, 2006 9:22 am

with the FacultyOfWidgetry site and db i setup the valuelist works, with my own site and db the valuelist does not work.

So based on what was discussed above my php install would be ok.

im going to try the print_r
dst01
 
Posts: 9
Joined: Wed Dec 31, 1969 5:00 pm

valuelists problem

Postby Jean » Tue Nov 27, 2007 7:51 am

Hello,
I thought I would find the solution but no. I have the same problem with this valuelists.ini :

Code: Select all
[select_OUI]
0 = Non
1 = Oui


I thing there is a problem with numbers.
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby shannah » Tue Nov 27, 2007 3:54 pm

Unfortunately INI files have the limitation that you cannot use:
Note: There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, and false. Values null, no and false results in "", yes and true results in "1". Characters {}|&~![()" must not be used anywhere in the key and have a special meaning in the value.

from: http://ca3.php.net/parse_ini_file

This appears to cause problems with the 0 key also.

One way around this is to move your valuelist into the database and change the valuelist definition to:
Code: Select all
[valuelistname]
    __sql__ "select ..."


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Jean » Tue Nov 27, 2007 3:58 pm

Thank you Steve, that is what have done, eventually.
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby GrosBedo » Sun Aug 17, 2008 10:59 am

Sorry to bump this old thread, but I had exactly the same problem.
I tried to use an enum, but the valuelists.ini won't be used as a dictionnary. I tried to change name and tweak the table. The only way I had to resolve it was to change the type of the field from ENUM to VARCHAR.

It seems that when using an ENUM, it will override any configuration you can put in a dctionnary in valuelists.ini
GrosBedo
 
Posts: 16
Joined: Wed Aug 13, 2008 10:44 am

Postby shannah » Mon Aug 18, 2008 9:39 am

Thanks for reminding me about this one. It is a simple fix that I shall have to incorporate into the next release.

In the Dataface/Table.php file, find the line that says:
Code: Select all
if ( preg_match('/^(enum|set)\(([^\)]+)\)$/', $row['Type'], $matches )){


Change it to:
Code: Select all
if ( !$row['vocabulary'] and preg_match('/^(enum|set)\(([^\)]+)\)$/', $row['Type'], $matches )){


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 21 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved