[ic] record created, but cant retrieve autonumber value on next page
Aaron Hazelton
interchange-users@icdevgroup.org
Fri Aug 23 09:44:00 2002
Kevin Walsh wrote:
>
> >
> > on a form-to-table page, I have the following (copied from
> > the UI pages) that will grab the autonumber:
> >
> > [if cgi new]
> > [perl tables="quote"]
> > my $db = $Db{$CGI->{quote}} or return;
> > unless ($db->config('AUTO_SEQUENCE')) {
> > $db->config('AUTO_NUMBER', '000001')
> > unless $db->config('AUTO_NUMBER');
> > $CGI->{item_id} = $db->autonumber();
> > }
> > return;
> > [/perl]
> > [/if]
> >
> > [set update_database]... etc. etc.
> > <form ..etc. etc..>
> > <input type=hidden name=code value="[cgi code]">
> >
> > the record is created just fine!
> >
> > but on the next page all of my values carry through except the
> > "code" - I tried [cgi code] and [value code] and either one
> > returns a blank even though the record was already created
> > by this point. How do you grab that value??
> >
> Perhaps I've not understood what you've written, but it seems to me
> that you should be using [cgi item_id] instead of [cgi code].
I did try using the [cgi item_id] but I still get nothing on the next
page.
However, like I said the record is created without a problem and
the next autonumber IS being used.
>
> On another note, something that could cause future problems is your
> use of the %Db hash in the following:
>
> [perl tables="quote"]
> my $db = $Db{$CGI->{quote}} or return;
>
> Shouldn't the "tables" parameter be set dynamically too, so the
> two lines read more like this:
>
> [perl tables="[cgi quote]"]
> my $db = $Db{$CGI->{quote}} or die 'Useful error message';
I really don't know much about perl, I just knew enough to copy
it from the admin UI page that allows creation of a new db record
from a form. I copied the code exactly and just changed the table
name in the code.
This is my first attempt at a totally user-manipulatable db from html
forms and using the autonumber feature... so im kind of confused.
any other ideas?
thanks!
>
> --
> _/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
> _/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n
> W a l s h
> _/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
> _/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
>
_____
Sincerely,
Aaron Hazelton
>>Hazenet<<
aaron@hazenet.net