Gossamer Forum
Home : Products : DBMan : Installation :

Doing something wrong

Quote Reply
Doing something wrong
Hi Alex,
DBMan is a great script and I am anxious to get it working . I have spent some time on this but thought I would try to get some help before I tear the rest of my hair out.
I am trying to set up a database that:
-requires no logon
-allows anyone to view and add
-allows modify/delete only of your own records.
I believe I have everything set up correctly. When I access the script and enter data for an add, all is well until I try to complet the add and I get the message-field 0 cannot be blank.Field 0 is the current date. I have set up userid to be field 12 and have set this to be auto-incremented.
I can put the files where they can be accessed if this is helpful. Thanks for any help
Quote Reply
Re: Doing something wrong In reply to
Can't be done. If you want modify/delete own records, people will have to log in in order to identify whether the person is the owner of the record. As it is, the owner of the record will be "default" every time.

Regarding the field 0 being blank, do you have the default set to
&get_date ?




------------------
JPD
Quote Reply
Re: Doing something wrong In reply to
Thanks for the response. Guess I will have to re-think things. Yes I have the first field filled in with the getdate function.
Quote Reply
Re: Doing something wrong In reply to
I have modified the configuration to allow for anyone to view but require log in for adding or modifying (ones own record) but continue to get the same error when trying to add: unable to add record, field 0 can not be blank. Debug is on and data shows all fields being filled in. Field 0 is now ID. Script is at http://www.pisource.com/cgibin/dbman2/db.cgi
I set up a directory with all files at http://www.pisource.com/dbtest
Thanks for any help !
Quote Reply
Re: Doing something wrong In reply to
Hi JMac

Try setting up the debug information on (db_debug = 1 Wink and see if your date field is being passed with the submit.

I assume you have something like this in your .cfg file...

Date => [0, 'date', 12, 15, 1, &get_date, ''],
.
.
.

Even though you have the default set up in your db_def, you still need to input the value of Date inside the form. i.e. you need to do something like this in your html_record_form...

<input type=hidden name="Date" value="$rec{'Date'}" >

Cheers
-JO
Quote Reply
Re: Doing something wrong In reply to
Sorry to interfere but I've the same problem: assuming that the date field was updated during "Add Record" time with the &get_date defined in the cfg file, how to show by default this field with the CURRENT date when the user goes in the "Modify Record" form ?

My field displays always the "Add Record" date ! I've tried without success the two suggestions given in one previous thread.

Thanks in advance for any help !
Quote Reply
Re: Doing something wrong In reply to
What I did was this:

At the beginning of html_modify_form_record, just after

if (!%rec) { &html_modify_failure...

add

$rec{'Date'} = &get_date;

Just be sure you have your "Date" exactly as it is in your .cfg file. (I keep harping on the fact that case is important, but so many people make the error that I don't want any one to forget. Smile )

------------------
JPD
Quote Reply
Re: Doing something wrong In reply to
There seems to be a field called "0" defined, even though you didn't intend it to be.

I would add the following lines to sub cgierr in db.cgi:

below

Code:
print "\nForm Variables\n--------\n";
foreach $key (sort keys %in) {
my $space = " " x (20 - length($key));
print "$key$space: $in{$key}\n";
}

add

Code:
print "\nDB Cols\n---------------\n";
$i = 0;
while ($db_cols[$i]) {
print "$i: $db_cols[$i]\n";
++$i;
}

That won't fix your problem, but you'll be able to see where that extra field is and help you track it down.


------------------
JPD
Quote Reply
Re: Doing something wrong In reply to
JPD
Thanks for your interest. I tried your suggestion and there is absolutely no change.What is it supposed to show? I also did a search for all instances of 0 in the files and no luck. I guess I can start from scratch and try again but would rather not if you have any further suggestions. thanks
Quote Reply
Re: Doing something wrong In reply to
It should have showed a field called "0" or one called "Field 0" but I see it didn't. Hmmmmmm.

(After much looking and thinking...)

Got it! (I think. Smile )

You have a field called

E-Mail_Address

You can't have a hyphen in your field name unless you put single quotes around it

'E-Mail_Address'

or you could do

E_Mail_Address

Please let me know if this works. I hate an "unsolved mystery"!! Smile

------------------
JPD
Quote Reply
Re: Doing something wrong In reply to
JPD,
Yep, that was it ! Sure glad you were around to nail it as that would have driven me crazy. All is well at least for now. See you on the next thread with my new "mystery"
Thanks very much.