Gossamer Forum
Home : Products : DBMan : Customization :

Help with "modify record"

Quote Reply
Help with "modify record"
I am working on a database for a client that uses PayPal as a shopping cart.

Here are the fieldnames from "default.cfg" and the sub html_record from "html.pl".

If I remove the portion enclosed by <!-- --> the I can select a record in the modify list and hit "modify records" and it will work, but if I remove the <!-- -->, I can't modify the record after selecting the radio button. Does this have to do with the hidden fields that are required by paypal? Do I need to add those fields to my database fields?

Below is the custom form (I have put the field names from my database in red so they are easy to see):

%db_def = (
Date => [0, 'date', 12, 15, 1, &get_date, ''],
Item => [1, 'alpha', 10, 255, 1, '', ''],
Category => [2, 'alpha', 0, 255, 1, '', ''],
Description => [3, 'alpha', '40x3', 500, 1, '', ''],
Sold => [4, 'alpha', 0, 3, 1, 'No', 'Yes|No'],
Size_L => [5, 'alpha', 12, 20, 1, '', ''],
Size_W => [6, 'alpha', 12, 20, 1, '', ''],
Price => [7, 'numer', 6, 255, 1, '', ''],
);


sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

print qq|
<td width="100" align="right" valign="top" style="padding-top:5px"><a href="javascript:void(0)" onclick="javascript:window.open('../../images/$rec{'Category'}/images/$rec{'Item'}.jpg', '', 'width=500, height=500');"><img src="../../images/$rec{'Category'}/thumbnails/$rec{'Item'}.jpg" border="0" alt="$rec{'Item'}"></a></td>
<td align="center"><a href="javascript:void(0)" onclick="javascript:window.open('../../images/$rec{'Category'}/images/$rec{'Item'}.jpg', '', 'width=500, height=500');"><b>$rec{'Item'}</b></a><br />
$rec{'Description'}<br />
$rec{'Size_L'}" L by $rec{'Size_W'}" W<br />
<strong>$rec{'Price'}</strong>
<br /><br />
<!--
<table cellpadding="0" cellspacing="0" border="0">
<tr align="center" valign="top">
<td>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/...tn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="test\@aol.com">
<input type="hidden" name="item_name" value="$rec{'Item'}">
<input type="hidden" name="amount" value="$rec{'Price'}">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</form></td>
<td>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="test\@aol.com">
<input type="image" src="https://www.paypal.com/...btn/view_cart_02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="display" value="1">
</form></td>
</tr>
</table>
-->
</td>
|;
}
Quote Reply
Re: [joshuagill] Help with "modify record" In reply to
Just a guess but I would check the page source coding and check to see that there isn't another form tag that isn't being closed before you are calling the paypal forms.

Looking at the default html.pl file I don't see a closing form tag after:

<INPUT TYPE="SUBMIT" NAME="modify_record" VALUE="Modify Record"> <INPUT TYPE="RESET" VALUE="Reset Form">

Try changing that to:

<INPUT TYPE="SUBMIT" NAME="modify_record" VALUE="Modify Record"> <INPUT TYPE="RESET" VALUE="Reset Form"></FORM> and see if that fixes the problem.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Help with "modify record" In reply to
I am not sure what you mean. I checked all of the modify_record areas, and they are closed with a </form>.

I can edit the record it I enter in the item name (db_key) exactly, but I can't edit it if I search using modify search and choose the record from the list. I hit the "Modify Record" button but nothing happens. No error message or anything.
Quote Reply
Re: [joshuagill] Help with "modify record" In reply to
I would have to see it in order to know what you're talking about.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Help with "modify record" In reply to
JPDeni --

I have attached my html.pl file for your review. Let me know if I can provide anything else.
Quote Reply
Re: [joshuagill] Help with "modify record" In reply to
If I can see it in action, I can likely figure out what's going on. My imagination isn't as good as it used to be, so I have trouble seeing code and imagining what the effect is. :)

I know I said not to send me private messages, but now I've changed my mind! :D If you can send me a URL and a username and password so that I can see exactly what you're seeing, I'll do my best to try to figure out why you're having the problem you're having.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [joshuagill] Help with "modify record" In reply to
My guess is that the problem is that you've just got too many things going on at once and the poor ol' program gets confused. You've got a javascript popup and a Paypal button and a radio button all dependent upon the ID value of your item.

Here's what I would suggest. Make a separate sub html_record. Call it sub html_record_simple. :) Copy your current sub html_record, but delete all the javascript and Paypal stuff so you're only left with the plain record with the info and the images. Change the call to html_record in sub html_modify_record to html_record_simple and see if that doesn't fix things for you. Even if it doesn't, it'll be easier to track things down without all the extraneous code that you don't need.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Help with "modify record" In reply to
Thanks again JPDeni!!

It fixed it!!