Gossamer Forum
Home : Products : DBMan : Customization :

An example of what I mean.

Quote Reply
An example of what I mean.
I've asked this as a question and have not got a response so I'll try an example. See in the fields below, I start with a 12. Well, I'd like 12 (or whatever ends up in that first field) to automatically be written to some of the other fields. Below they are | | blank.

12|blah|blah|blah| |blahagain|sdfsaf|lnfalnsa| |fafdfl|anfd|lgfna| |lfngkf|lngfsa|lsdfa| |sdfa|sfasd|fasdf|admin
Quote Reply
Re: An example of what I mean. In reply to
Did you try my earlier suggestion of using $db_key as the default attribute in the fields that you want this number to appear????

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: An example of what I mean. In reply to
Yes, I put 'db_key' as the default in my app.cfg and even tried '$db_key' in the default in my app.cfg. This only wrote literally db_key or $db_key into those fields instead of the value thereof. Unless I am misunderstanding what you mean by attribute?

By the way, I went to your Anthrotech site today. I like what you have done there. Good luck with your new job as well.

Neil
Quote Reply
Re: An example of what I mean. In reply to
Try using Eliot's suggestion of putting $db_key as the default in these fields with one exception. Delete the single quotes from around it. Single quotes mean that anything in between will be considered a string whether it is a variable or not.

Code:
Type => [3, 'alpha', 0, 60, 1, $db_key, ''],
or
Type => [3, 'alpha', 0, 60, 1, "$db_key", ''],
That should do it.

------------------
WFMY-TV Webmaster

[This message has been edited by Chris071371 (edited December 14, 1999).]
Quote Reply
Re: An example of what I mean. In reply to
 
Thanks for the idea.

I tried both $db_key and "$db_key" and it doesn't work.

Any other suggestions on how I might solve this problem?

Neil
Quote Reply
Re: An example of what I mean. In reply to
Alright, $db_key has not been evaluated at this point. The easy way around this would be to create hidden fields in html_record_form. Name these fields whatever the field names are that you want to replace with the $db_key.

example: if your $db_key is ID, and the fields you want this value to go into are named FIELD1 and FIELD2,then do this.
Code:
<input type="hidden" name="FIELD1" value="$rec{'ID'}">

<input type="hidden" name="FIELD2" value="$rec{'ID'}">
That should do it.

------------------
WFMY-TV Webmaster

[This message has been edited by Chris071371 (edited December 14, 1999).]
Quote Reply
Re: An example of what I mean. In reply to
 
I tried that too:

<input type="hidden" NAME="Record2" VALUE="$rec{'Application_Number'}">
Quote Reply
Re: An example of what I mean. In reply to
When you say "that didn't work", what exactly did it do, and where did you put it? Did you put it in html.pl in the sub routine html_record_form?

I tested this last night and it worked fine.

------------------
WFMY-TV Webmaster
Quote Reply
Re: An example of what I mean. In reply to
<input type="hidden" NAME="Record2" VALUE="$rec{'$Application_Number'}">

in the html_record_form of my .pl

Nothing happens the Record2 field is the first blank one you see. Here is an example output:
980|dsgs|dfg|g&#0124; &#0124;fg|sg|sdfg&#0124; &#0124;fgds|gsdgf|gdsgd&#0124; &#0124;asdfas|dfas|gsdfgsa&#0124; &#0124;sdfasfd|asdfas|asdfa|admin

The record2 field is simply blank in .db. The other blank fields you see are other hidden fields that I would like to do this with when I figure it out. Thank you very much for helping me with this challenge.

Neil
Quote Reply
Re: An example of what I mean. In reply to
Can you give me the URL to DBMan on your site?

------------------
WFMY-TV Webmaster
Quote Reply
Re: An example of what I mean. In reply to
 
Sure, http://www.wusata.org/admin/db.cgi?db=app2

Please feel free to e-mail me if you want at neil@pacifier.com if you have questions about how I have it set up. Thank you for your help!
Quote Reply
Re: An example of what I mean. In reply to
Take the $ out of the record hash!

It should look like the following:

Code:
<input type="hidden" NAME="Record2" VALUE="$rec{'Application_Number'}">

Hope this helps.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: An example of what I mean. In reply to
 
I tried it without the $ and it does not work.
Quote Reply
Re: An example of what I mean. In reply to
I tried this URL and it doesn't work.

------------------
WFMY-TV Webmaster
Quote Reply
Re: An example of what I mean. In reply to
http://www.wusata.org/cgi-bin/app/db.cgi?db=app2

oops. this is the URL.

Quote Reply
Re: An example of what I mean. In reply to
I copied this from your source code. When "no records found" page came up
I didn't get a close > before </TH> on input Application_Number might look at html.pl
sub record_form
Code:
<TABLE Align="Center" WIDTH="80%" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TH VALIGN="TOP" WIDTH="475">Enter App Number Here <INPUT TYPE="TEXT" NAME="Application_Number"
SIZE="20"
VALUE="*"</TH>
</TABLE>

I don't know if this has anything to do with this.
Quote Reply
Re: An example of what I mean. In reply to
 
And I tried variations as well:

$Application_Number

"$Application_Number"

Still won't work. This has to be possible.
Quote Reply
Re: An example of what I mean. In reply to
That is most likely the problem. Again, Neila, you need to be more specific about what errors you see rather than just stating "it doesn't work". That is not a helpful statement!

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: An example of what I mean. In reply to
Ok, I see that you are using your own $db_key instead of letting DBMan assign one. This is why the above solution didn't work. This will work.

For all of the fields that you want the $db_key to go into, delete the input fields for for each of those db fields.

Next go into your db.cgi and go to the add_record subroutine. After
Code:
my ($output, $status, $counter);
and before
Code:
$status = &validate_record;
addthis line foreach field that you want the $db_key to go into.
Code:
$in{'Record2'} = $in{'Application_Number'};
So it should look like this if you wanted Application_Number to go into Record2 and Record3.
Code:
my ($output, $status, $counter);


$in{'Record2'} = $in{'Application_Number'};
$in{'Record3'} = $in{'Application_Number'};
$status = &validate_record;

That should do it. You need to do this in modify_record also.

There are people who help and people who criticize.




------------------
WFMY-TV Webmaster



[This message has been edited by Chris071371 (edited December 15, 1999).]
Quote Reply
Re: An example of what I mean. In reply to
IT WORKED!!

This is great.

# right below:
my ($output, $status, $counter);

# I put:
$in{'Record2'} = $in{'Application_Number'};

And I'll do that for each record that needs the key. This enables me to move forward. Thank you for your help.
Quote Reply
Re: An example of what I mean. In reply to
Make sure you add this to modify_record also. If you don't, when you modify your records, you will lose these fields.

Also in html_record form, you need to put the $rec{'field'} hash values in the value field of each input field. That way when you go to modify a record, you values will be filled in from the database.

Example:
Code:
<input type="text" name="Application_Number" value="$rec{'Application_Number'}">

------------------
WFMY-TV Webmaster