Gossamer Forum
Home : Products : DBMan : Customization :

Trouble with Validate Records Mod

Quote Reply
Trouble with Validate Records Mod
Installed Validate Records Mod and have an issue. All works except for Success or Deletion of by Admin User. I get a CGI error ('Internal Server Error').

Please help.

Here are the text files of my db and html files just in case.
http://www.real-gear.com/dev/html.txt
http://www.real-gear.com/dev/db.txt

Thanks!

Chris
Quote Reply
Re: [jnjhost] Trouble with Validate Records Mod In reply to
I noticed in your add_form you have:

|;
if ($per_admin) {
print qq| <tr> <td align="right">Validated:</td>
<td valign="top"> |; print &build_radio_field($db_validated_field,$rec{$db_validated_field}); print "</td></tr> ";
}
else {
print qq| <input type="hidden" name="$db_validated_field" value="$rec{$db_validated_field}"> |;
}
if ($per_admin) {
print qq|<tr> <td align="right">Premium:</td>
<td valign="top"> |; print &build_radio_field($db_premium_field,$rec{$db_premium_field}); print "</td></tr>";
}
else {
print qq|<input type="hidden" name="$db_validated_field" value="$rec{$db_validated_field}"> |;
}

You have the validation field defined twice as a hidden field in the last section it should be:


if ($per_admin) {
print qq|<tr> <td align="right">Premium:</td>
<td valign="top"> |; print &build_radio_field($db_premium_field,$rec{$db_premium_field}); print "</td></tr>";
}
else {
print qq|<input type="hidden" name="$db_premium_field" value="$db_premium_field"> |;
}

Or you can shorten that layout by using:

|;
if ($per_admin) {
print qq|<tr><td align="right">Validated:</td><td valign="top"> |; print &build_radio_field($db_validated_field,$rec{$db_validated_field}); print qq|</td></tr> |;
<tr><td align="right">Premium:</td><td valign="top"> |; print &build_radio_field($db_premium_field,$rec{$db_premium_field}); print qq|</td></tr> |;
}
else {
print qq|<TR><TD colspan=2">
<input type="hidden" name="$db_validated_field" value="$rec{$db_validated_field}">
<input type="hidden" name="$db_premium_field" value="$db_premium_field">
</TD></TR> |;
}

Hope that solves the problem.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Trouble with Validate Records Mod In reply to
Well, I used your code. And as correct as you were, it didn't fix the issue. I still get an Internal Server Error. Here is the code I entered with your direction.
Code:
if ($per_admin) {
print qq| <tr> <td align="right">Validated:</td> <td valign="top"> |;
print &build_radio_field($db_validated_field,$rec{$db_validated_field});
print "</td></tr> ";

print qq|<tr> <td align="right">Premium:</td> <td valign="top"> |;
print &build_radio_field($db_premium_field,$rec{$db_premium_field});
print "</td></tr>";
}
else {
print qq|<TR><TD colspan=2">
<input type="hidden" name="$db_validated_field" value="$rec{$db_validated_field}">
<input type="hidden" name="$db_premium_field" value="$db_premium_field">
</TD></TR> |; }


http://www.real-gear.com/dev/html.txt
http://www.real-gear.com/dev/db.txt

Thanks Lois for your help! Luckily the record validates. It's just that the success page does not show, just the error.

Chris
Quote Reply
Re: [jnjhost] Trouble with Validate Records Mod In reply to
Quote:
Internal Server Error

Usually to me this indicates something is wrong with the working of the script and not so much missing a bracket or bad syntax.

Try "turning off" the email portion of the add_success pagea and see what happens.

Likewise try turning off the file upload and things such as that until you find out what is causing the script to break.

It is going to be something like a mis-configured email sub or something like that.

Try moving the email sub to the "bottom" of the add_success page... I've had that cause problems in the past when it was at the "top" or beginning of the subroutine.
Quote Reply
Re: [Watts] Trouble with Validate Records Mod In reply to
The more I think about it, the more I'm sure the email routine in add_success is going to cause your problems.

The reason is you are trying to email a record *before* you've gotten the record data in the middle of the page here:

Code:
|; &html_record(&get_record($in{$db_key})); print qq|
Quote Reply
Re: [Watts] Trouble with Validate Records Mod In reply to
Isn't the line: %rec=&get_record($in{$db_key}); which comes before the email routine where the record is imported? The line you referenced is only so the record shows on the screen when successful.

And isn't add_success only for adding a record? Not modifying. When a record is Validated by the admin, isn't it "modified"?

Add_success works fine and emails the admin when a record is added. It's when a record is modified to "validate". How exactly can I shut off the email for that part of the deal?

Thanks!!

Chris
Quote Reply
Re: [jnjhost] Trouble with Validate Records Mod In reply to
You still have some problems with your html coding.

<input type="hidden" name="$db_premium_field" value="$db_premium_field">

should be:

<input type="hidden" name="db_premium_field" value="$rec{'db_premium_field')">


print &build_radio_field($db_premium_field,$rec{$db_premium_field});

should be:

&build_radio_field("db_premium_field",$rec{'db_premium_field'}); print qq|


<input type="hidden" name="ent_date" value="$rec{$today}">
<input type="hidden" name="edit_date" value="$rec{$today}">

these fields should have the value being the same as the name of the field:

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


For the data entry date you could have it automatically insert today's date by using for instance:

ent_dt => [17, 'date', 20, 25, 0, &get_date(),''],

If you want the date modified for the 'edit_date' field then In sub html_modify_form_record, just after

my (%rec) = &get_record($in{'modify'});

add:

$rec{'edit_date'} = &get_date;

This will automatically enter the date the record was modified.

Not sure why you are using the sub html_record_form_mod??? Is this because you only want certain fields to be displayed when modifying a record? You would need to make all the fixes in any subs where you are defining the field inputs.

There are also several other subs which aren't defined with your db.cgi so that they know where to goto when you call these subs.

Are you sure everything was working properly prior to adding the validation mod?

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/

Last edited by:

LoisC: Jun 29, 2004, 11:09 AM