Gossamer Forum
Home : Products : DBMan : Installation :

Unable to Add Record

Quote Reply
Unable to Add Record
I am getting an error when I attempt to add records to my database.. The error is as follows:

Error: Unable to Add Record

There were problems with the following fields:
Thursday (Too long. Max length: 6)

Below is my database definition.. What am I missing here?? Now I should note that I tried to fix this by changing the max length for the "Thursday" field.. (Stranger things have happened to work..) However, when I changed the Max length for my "Thursday" field it lets me add records but when I do not check off the Thursday checkbox, it enters a value of "Default" in my database. How do I get that to stop??

# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 255, 1, '', ''],
Today => [2, 'date', 12, 15, 1, &get_date, ''],
WeekEnding => [2, 'date', 12, 15, 1, '', ''],
Monday => [3, 'alpha', 6, 6, 0, '', ''],
Tuesday => [4, 'alpha', 6, 6, 0, '', ''],
Wednesday => [5, 'alpha', 6, 6, 0, '', ''],
Thursday => [6, 'alpha', 6, 6, 0, '', ''],
Userid => [7, 'alpha', -2, 15, 0, '', '']
);

# The column name for the database key. Can be any column, but it must be unique!
# You can't have two records with the same key value!
$db_key = 'ID';
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 1;
# Database delimeter.
$db_delim = ',';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95.
$db_use_flock = 1;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 1;
# Display Benchmarking Information (1 = Yes, 0 = No).
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 0;

# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
);

# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = ( );

# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = (
Monday => 'Yes',
Tuesday => 'Yes',
Wednesday => 'Yes',
Thursday => 'Yes',
);

Diva is not just a title, it's a way of life!!!
Quote Reply
Re: Unable to Add Record In reply to
You need to add Yes in the valid expression columns for the day fields.

And you need to change the following codes:

Code:

Thursday => 'Yes',


to the following:

Code:

Thursday => 'Yes'


NO comma...last field in hashes do NOT need a comma at the end of the code line.

Regards,

Eliot Lee
Quote Reply
Re: Unable to Add Record In reply to
Hi divavocals, you need to correct your database definitions. The Thursday field is trying to enter user info into the database because the fields are misnumbered.

You have:
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 255, 1, '', ''],
Today => [2, 'date', 12, 15, 1, &get_date, ''],
WeekEnding => [2, 'date', 12, 15, 1, '', ''],<<duplicated field number
Monday => [3, 'alpha', 6, 6, 0, '', ''],
Tuesday => [4, 'alpha', 6, 6, 0, '', ''],
Wednesday => [5, 'alpha', 6, 6, 0, '', ''],
Thursday => [6, 'alpha', 6, 6, 0, '', ''],
Userid => [7, 'alpha', -2, 15, 0, '', '']
);

Correct the numbering on your fields and you should be fine. (You'll also need to remove that last comma as Eliot indicated.)