Gossamer Forum
Home : Products : DBMan : Customization :

Need Help - Confirmation Screens

Quote Reply
Need Help - Confirmation Screens
Probably simple fix here, but I need help nonetheless.

My problem deals with the confirmation of the following actions: Sucessful entry of a record, confirm record for deleting, and confirm record for modifying. When I enter a record, it comes back with "Record Added" and then displays the record that was enterd, only the record is blank. (The record was entered, just that on this screen it is blank). When I go to delete a record, find the one I want to delete, it presents me with the record and then asks 'Delete?', but here again the record shows up blank. And again with the Modify confirmation screen.

I did not change anything in this area of the script. Is there something that is supposed to have been? Is there something that I needed to change here when I changed the layout of the record up at the beginning of the html.pl file? I am confused. The records do get entered, but I get no 'feedback' as it were.

Could someone please help me? The sooner the better too. I thank you for your help.

Andrew
Quote Reply
Re: Need Help - Confirmation Screens In reply to
This sounds like a problem with the $db_key setting. You need to check that the $db_key variable (in the .cfg file) is set to the name of the field you want to have as your key.

------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
Thanks for the quick response, but I have already checked that. But I am not sure if maybe I am not seeing it. Becuase now (well, I say now, I just hadn't checked this far yet) I can't delete any record either. I get the answer of :

Code:
%db_def = (
ID => [1, 'numer', 5, 8, 1, '', ''],
Announce => [2, 'alpha', 5, 15, 1, '', ''],
Category => [3, 'alpha', 0, 30, 1, '', ''],
URL => [4, 'alpha', 40, 255, 1, 'http://co.pinal.az.us/hr/postings/', '^http://co.pinal.az.us/hr/postings/'],
JobTitle => [5, 'alpha', 25, 60, 1, '', ''],
JobType => [6, 'alpha', 0, 25, 1, '', ''],
JobStatus => [7, 'alpha', 0, 15, 1, '', ''],
FFDate => [8, 'alpha', 20, 25, 0, &get_date, ''],
HRange => [9, 'alpha', 25, 50, 1, '', ''],
Position => [10, 'alpha', '40x3', 2500, 0, '', ''],
MinQual => [11, 'alpha', '40x3', 2000, 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';

I do not understand why I am getting these errors.

If you see what I am doing wrong, please let me know. If there is additional info you need, again, just let me know. This is strange. I never messed with this part of the code, and even left the db_key part the way it came in the demo.

Any help is greatly appreciated. Thanks.

[This message has been edited by CyberRatt (edited June 21, 1999).]
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Is it possible that you added or subtracted fields after you had records in the database?


------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
I hadn't thought of that, but the answer is no. I didn't add or delete any fields once I started entering in data. What I did do, though, was I had to modify the fields as I was entering in records. I thought I had made a field long enough, but then would run into a title or description where I needed to make the field's max length longer. SO I changed the length number in the .cfg file. But I didn't add/remove any fields. By doing these mods, did I mess up some internal setting?

Now, wait... I did take the original files (the demo ones) and modify them to my needs. There was the dummy records in there originally, but as I mentioned earlier, I kept the db_key field (the 'ID' field) the same. I did extend it from a minimum 3 to 5 characters though. Could this be the problem? Do I need to copy all the files (except the db.cgi file) and rename them to a new name so the script thinks it's a new database?

Let me know. Thanks for your help thus far.
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Your changing the field length wouldn't matter. Your keeping the demo records could matter a whole bunch! Did you have a different number of fields than in the demo, without removing the data from the demo default.db file? I see that you have 12 fields and the demo only has 10. That will mess you up a whole lot, if you have kept the dummy records in your .db file.

What I would do is upload a completely blank .db file and add records into that. One way or another your .db file seems to have become messed up and this is the quickest way to fix it.

------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
Ok, so let me just paraphrase this so you can see if I am on the same page with you...

rename the current *.db file to something else. Make a new (blank) *.db file. Run the db.cgi so it sees a blank database, but with the correct number of fields in memory. Then, and here is one last question, can I just copy the contents of the .db file (the one with my records, not the demo ones) into the new one? Or do I need to start all over again? I am only at 63 records so far, but I would like to avoid doing it all over again if possible. Oh, one more question. What about just renaming the .db file to some 'othername.db' and change the section in the .cfg file to match? Would this force the db.cgi script to see it as a new database?

Thanks again.
Quote Reply
Re: Need Help - Confirmation Screens In reply to
You can name your database file anything you want, so long as you specify it in the .cfg file.

You can try copying your data into the new .db file and see what happens. If it works, that's great. If not, you may have to re-enter the data.


------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
Dear CyberRatt

I think your problem is really simple. YOUR .cfg FILE IS WRONG. The first field in your .cfg file should be labeled with the number 0 in the first column, NOT the number 1.

Remember, all PERL arrays start with 0 being the first item, NOT 1.

If you change your .cfg file so that the fields are number 0 to 10 rather than 1 to 11 I think everything will work fine!

Sincerely,
Lauren Stegman
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Ok, I will give that a try. But I am having a new problem now. Instead of burrying that problem way down here in this thread, I am going to post a new question. If you can help there also (and you too JPDeni) I sure could use it, and quickly!

Thanks
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Lauren Stegman,

Thank you, thank you, thank you!! It worked! Tell the boss I think you should get a raise!! Smile

Don't feel left out JPDeni, you helped me a lot too! Smile

Andrew
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Thanks, Lauren. I missed that in the .cfg file. That's what's so great about the forum. Multiple sets of eyes can find things better.

------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
Preview Screen

I was wondering if there is a way to re-work the Confirmation Screen that does not automatically add records into the .db file.
One of my clients mentioned that his data managers are having some problems with adding records in terms that if they need to modify a record, they have click on "Modify", select the record, then make changes. This is a clumsy process.

I was wondering if a confirmation mod can be programmed that would allow data managers the ability to preview a record before submitting it to the database file??? Please help...
My client is DEMANDING this option, but I am only able to give him quick and dirty hints about inserting text into the fields. I do not have time to add a sub-routine or mod for him. But if anyone has been able to do this successfully, your assistance is greatly appreciated.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited July 04, 1999).]
Quote Reply
Re: Need Help - Confirmation Screens In reply to
I just wrote this for my own database, but I haven't tested it yet.

In db.cgi, in the midst of all the "elsif" statements in sub main, add

Code:
elsif ($in{'preview_record'}) { if ($per_add) { &preview_record; } else { &html_unauth; } }

Add a new subroutine to db.cgi. (I put it just after sub add_record, but you can put it anywhere, as long as it isn't within another subroutine.

Code:
sub preview_record {
# --------------------------------------------------------
my ($status, $counter);
# Set the userid to the logged in user.
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);

# First we validate the record to make sure the addition is ok.
$status = &validate_record;

# We keep checking for the next available key, or until we've tried 50 times
# after which we give up.
while ($status eq "duplicate key error" and $db_key_track) {
return "duplicate key error" if ($counter++ > 50);
$in{$db_key}++;
$status = &validate_record;
}
if ($status eq "ok") {
&html_preview;
}
else {
&html_add_failure($status);
}
}

In html_add_form (html.pl) change

<INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record">

to

<INPUT TYPE="SUBMIT" NAME="preview_record" VALUE="Add Record">

Add a new subroutine. I put it just after html_add_form.

Code:
sub html_preview {
# --------------------------------------------------------
&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Record Preview.</title>
</head>

<body bgcolor="#DDDDDD">
<center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 align=center valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Record Preview</b>
</td></tr>
<tr><td>
<p><center><$font_title><b>Record Preview</b></font></center><br>
<$font><P><Font face="Verdana, Arial, Helvetica" Size=2>This is your record as you entered it.
If you are satisfied with it, use the "Add it!" button directly below the review.
Otherwise, make the changes in the form and use the "Add Record" button below the form.:</FONT>
|;

&html_record(%in);

print qq|
<form action="$db_script_url" method="POST" name="form1">
<center><INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add It!"><HR></center>
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
|;

&html_record_form (%in);

print qq|
<p><center>
<INPUT TYPE="SUBMIT" NAME="preview_record" VALUE="Add Record">
<INPUT TYPE="RESET" VALUE="Reset Form"></center></p></form>
|;
&html_footer;
print qq|
</td></tr>
</table>
</center>
</body>
</html>
|;
}

In html_add_failure, change

<INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record">

to

<INPUT TYPE="SUBMIT" NAME="preview_record" VALUE="Add Record">



------------------
JPD







[This message has been edited by JPDeni (edited July 04, 1999).]

[This message has been edited by JPDeni (edited July 04, 1999).]
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Carol,

Great mod! I noticed two problems...(one I was able to fix):

1) When I added a record, it went directly to the add_success sub-routine.

Solution: I added in the following code to the add_form sub-routine in the db.cgi file:

Code:
&html_preview_form;

AFTER

&auth_logging("added record: $in{$db_key}") if ($auth_logging);

2) The "Add It" button does not work (because it is not attached to FORM). I tried the INPUT code underneath the <FORM..> line.
But I kept getting errors. The Record appears as blank when I click on the "Add It" button.
Here are the Errors I get:

ID (Can not be left blank)
Title (Can not be left blank)
Year (Can not be left blank)
Medium (Can not be left blank)
Author (Can not be left blank)
Keywords (Can not be left blank)
Date (Can not be left blank)
LastModified (Can not be left blank)
LastModified (Invalid date format)

I added in the following codes above the "Add It" button:

Code:
<form action="$db_script_url" method="POST">
<input type=hidden name="db"
value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="add_record" value="1">
|;
&html_record_long(%in);
print qq|
<center>
<INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record!">
</center>
</form>

If we can figure out how to get this to work, then we are set to go...I think.

Thanks again for your assistance.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited July 04, 1999).]

[This message has been edited by Eliot (edited July 04, 1999).]
Quote Reply
Re: Need Help - Confirmation Screens In reply to
 
Code:
print qq|<form action="$db_script_url" method="POST" name="form1">
<center><INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add It!"><HR></center>

I'll try to remember to fix that after I submit this message.

You should be able to have just one form, with two submit buttons.


------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
Carol,

Very very odd! I went to see the fireworks in town with a friend...came back and tried the changes again...It worked this time!

I think the following codes screwed it up:

Code:
<input type=hidden name="preview_record" value="1">

I deleted them and it works.

FYI: I also added a "Delete Record" button by adding in the following codes to the html_preview_form sub-routine in the html.pl:

Code:
<form action="$db_script_url" method="POST" name="form1">
<input type=hidden name="db"
value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="$tmp{$db_key}" value="delete">
<center>
<hr noshade size="2" width="600">
<INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record!"> &nbsp
<INPUT TYPE="SUBMIT" name="delete_records" VALUE="Delete Record!">
<hr noshade size="2" width="600"> </center>
<P>
|;
&html_record_form(%in);
print qq|
<p><center>
<INPUT TYPE="SUBMIT" NAME="preview_record" VALUE="Preview Record">
<INPUT TYPE="RESET" VALUE="Reset Form">
</center></p></form>

It works like a charm.

Thanks again for your speedy and useful tips!
I (and I hope my client) appreciate your assistance.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited July 05, 1999).]
Quote Reply
Re: Need Help - Confirmation Screens In reply to
Have you tested out the delete part? I'm not sure it will work. You have

Quote:
<INPUT TYPE=CHECKBOX NAME="$tmp{$db_key}" VALUE="delete">
<INPUT TYPE="SUBMIT" name="delete_records" VALUE="Delete Record!">

but there has been no $tmp{$db_key} variable assigned at that point.

I think you could use $in{$db_key}, though.

Wait a minute. You don't need to have a delete on the preview page. Nothing has been added to the .db file yet. If they want to completely abandon adding the record, they just need to go to another page in the database without clicking "Add It!"

Glad I was able to help. Smile


------------------
JPD





Quote Reply
Re: Need Help - Confirmation Screens In reply to
I did test it out and the only bug (not really a bug, just a glitch to the user) is that on the Deletion Screen, the record shows up as
"..

I know that this is overkill, but believe me, my client is hypersensitive about these types of issues. Having it in there, while being overkill, is something that I am anticipating that he will want to have.

But this mod is great! It will hopefully save the data manager some time by reducing the amount of clicking and searching.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited July 05, 1999).]

[This message has been edited by Eliot (edited July 05, 1999).]