Field “required” when set to not required

Archived from the Xataface Users forum.

njw — Tue Apr 25, 2006 3:35 am

Hi Steve

Probably something I don’t understand properly.

I have a table Person that contains rudimentary data about people, including phone number - see definition below:

Person

| Field | Type | Null | Default | | — | — | — | — |

PersonId int(11) No  
Surname varchar(40) No  
Forenames varchar(64) No  
Email varchar(40) Yes NULL
Phone varchar(40) Yes NULL
Comments longtext Yes NULL

In the fields.ini I have the following lines:

[Phone]
widget:atts:size = 20
validators:required = false

Yet, when I go to the entry form, Phone is flagged as required.

Any idea what I’ve got wrong?

Many thanks

Neil


shannah — Tue Apr 25, 2006 7:18 am

Hi Neil,

Unfortunately you must use 0 to indicate false, as the PEAR_Config class (which datface uses to load its ini files) reads “false” as the string “false” and not the boolean value false, so that “false” actually means true!.

I sent in a bug report to PEAR_Config about this a while back but they decided that it is just a documentation issue(i.e., they’re not going to change it).

Hope this helps.

-Steve


njw — Tue Apr 25, 2006 8:52 am

and I thought M$ were the only ones who had bugs called features!


njw — Wed Apr 26, 2006 7:49 am

Sorry Steve - tried that:

[Phone]
widget:atts:size = 20
validators:required = 0

Stil comes up as a required field.

Neil


shannah — Wed Apr 26, 2006 10:36 am

Hi Neil,

I have filed a bug report and submitted a fix for this issue at:
http://sourceforge.net/tracker/index.php?func=detail&aid=1477096&group_id=153729&atid=788932

Best regards

Steve


njw — Thu Apr 27, 2006 2:24 am

Thanks Steve. Works fine.

Neil


ozrebel — Sun Nov 19, 2006 5:36 am

Hi Steve.

Firstly please let me say that this is one of the best pieces of software I reckon I’ve ever found on the net! Great work, and a terrific helpful website.

Now, on to my problem

I am also having the same problem as outlined above. I have downloaded the updated Table.php file as indicated in the tracker, but get the following error:

Fatal error: Call to undefined function: getactions() in /home/mistro/public_html/dataface/Dataface/ActionTool.php on line 71

Interestingly, the fields which are showing up as required all appear to have collation set, and any fields which I have in the database without collation set are not defaulting to required.

Unfortunately phpMyAdmin will not allow me to change fields to blank collation, and adding new fields defaults to ASCII collation delivering the same problem.

Any clues?

Cheers

Tony


shannah — Mon Nov 20, 2006 3:30 pm

Hi Tony,

The tracker reference in this thread is a little old now. If you’re using a more recent version of Dataface, it will have a newer version of Table.php in it. Recommend you re-download the latest Table.php file from sourceforge and go from there.

Let me know how it goes.

Best regards

Steve


ozrebel — Tue Nov 21, 2006 11:42 am

G’day Steve.

Thanks for your reply.

I have re-downloaded dataface-0.6.9r1 package, extracted, and replaced my current table.php file with the one in the package, and there has been no change - still all non numeric fields displaying as required by default, and unchangable with validators set to either 0 or false.

Cheers

Tony


shannah — Tue Nov 21, 2006 2:10 pm

Hi Tony,

Can you post the relevant portions of your table definitions (e.g. the create table statements), and the fields.ini files so that I can take a look and try them out to track down the bugs…

One thing that occurs to me is that any field that is set NOT NULL will show up as required…

Best regards

Steve


ozrebel — Tue Nov 21, 2006 3:31 pm

Thanks Steve. It was the NOT NULL.

Cheers

Tony


ozrebel — Tue Nov 21, 2006 3:31 pm

Thanks Steve. It was the NOT NULL.

Cheers

Tony