Gossamer Forum
Home : Products : DBMan : Customization :

Help with Send Record Mod

Quote Reply
Help with Send Record Mod
I am using the send record mod and want to make one change... I want the record to forward, but I don't want the sender to have the option of editing it before they click "submit" - I don't want them to be able to even see the record they are sending.

In sub html_forward_email_form I have tried several things, including replacing the textbox with this

<input type=hidden name="emailmessage" value="$in{'email_message'}">

The above messes up my table, and doesn't work- I get the error that my message is empty. I've tried a dozen other things and am at a loss. Help?



p.s. I think the problem is caused because my records which I'm forwarding may sometimes have html tags and/or double quotes in them.

Last edited by:

sigrid: Jun 27, 2002, 1:05 PM
Quote Reply
Re: [sigrid] Help with Send Record Mod In reply to
I have my db set up where the person sending the record only gets 2 boxes...their name and their friends email address. The subject is hidden and so is the message. This is what I have in my db.cgi send_email sub:

Code:
if ($message) {
chomp($message);
&html_forward_email_form($message);
return;
}
open (MAIL, "$mailprog") || &cgierr("unable to open mail program");
print MAIL "To: $in{'to_email'}\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $in{'subject'}\n\n";
print MAIL "Your friend $in{'friend'} found this listing at StayFlorida.com\n";
print MAIL "and thought you might be interested.\n";
print MAIL "\n";
print MAIL "You can view this listing here:\n";
print MAIL "http://www.wdu.net/cgi-local/dbman/db.cgi?db=default&uid=default&view_records=1&ID=$in{'ID'}&ww=1\n";
print MAIL "\n";
print MAIL "Please send $in{'friend'} our thanks to for referring you.\n";
print MAIL "\n";
print MAIL "Sincerely;\n";
print MAIL "\n";
close (MAIL);
&html_forward_email_success;
}

then in my html_send_email sub, I have the subject field and the email message field hidden from all but admin. Works fine for me.
Quote Reply
Re: [wdu2002] Help with Send Record Mod In reply to
Do your subject fields and email message fields ever have html characters or double quotes in them?
Quote Reply
Re: [sigrid] Help with Send Record Mod In reply to
I have them all in a table if thats what you mean. This is what my html_forward_record looks like:

Code:
<table>
<tr><td colspan="2" align=left>
<font face="Arial, Verdana, Helvetica"><font size=2>
Want to tell a friend about <font color="blue"><b>$rec{'Title'}</b></font>?<br>
Just enter your name and your friend's email address and we will forward the record directly to their email.
<p>
</td>
</tr>
<tr><td align=right><$font>Your Name:</font></td>
<td><input type=text name="friend" value="$in{'friend'}" size=40></td></tr>
<tr><td align=right><$font>Recipient's email address:</font></td>
<td><input type=text name="to_email" value="$in{'to_email'}" size=40></td></tr>|;
if ($per_admin) {
print qq|
<tr><td align=right><$font>Subject:</font></td>
<td><input type=text name="subject" value="A friend has sent you a listing from StayFlorida.com" size=40></td></tr>
|;
}
else {
print qq|
<td><input type=hidden name="subject" value="A friend has sent you a listing from StayFlorida.com" size=40></td></tr>
|;
}
if ($per_admin) {
print qq|
<tr><td align=right><$font>Your message:</font></td>
<td><textarea name="emailmessage" cols=40 rows=10 wrap="virtual">$in{'emailmessage'}</TEXTAREA></td></tr>
|;
}
else {
print qq|
<td><input type="hidden" name="emailmessage" value="$in{'emailmessage'}" size=200></td></tr>
|;
}
print qq|
</table>
Quote Reply
Re: [sigrid] Help with Send Record Mod In reply to
Notice this line:

<input type=hidden name="emailmessage" value="$in{'email_message'}">

you have to match the name with the value. check both subs and make sure they are both referring to either:

emailmessage

or

email_message

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Help with Send Record Mod In reply to
No, that isn't what I mean. The email_message (the record) itself had the tags, and may be very long. So when I put

<input type=hidden name="emailmessage" value="$in{'email_message'}">

Then, it may do something like this:

<input type=hidden name="emailmessage" value="blah blah" foo>">

blah blah" foo> is the message, and obviously screws up my input field.

Lois, all my code is correct.

Looking at the actual source code of the html pages might help. Go here http://www.lib.lsu.edu/...review/military.html and then click on a book title (number 7 is good, because it is a long one). Try emailing it to yourself- after you click on send record to a friend, look at that source code.

Then do the same for number 2- it has no html in the record, and is short, and works like it should.

Sigrid
Quote Reply
Re: [sigrid] Help with Send Record Mod In reply to
For record 7 for some reason your </HTML></BODY> is not at the end of the actual page

but you have a stray "> appearing on the output page for both records which could be causing you problems:


Save 10% to 46% when you buy this book!
For pricing and availability go to

http://www.booksamillion.com/ncom/books?AID=42121&PID=365257&isbn=055309633

Copyright 2002. Civil War Book Review
ALL RIGHTS RESERVED
http://www.civilwarbookreview.com
">

I'm not sure why you are not just showing the form when they want to send the record rather than repeating the whole record. You could just include the book title.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Help with Send Record Mod In reply to
That isn't a stray "> if you look at it more closely, that's the end of the hidden input field. There is nothing technically wrong with my code.

I think I can just come up with something myself if no one has any suggestions. Thanks anyway.
Quote Reply
Re: [sigrid] Help with Send Record Mod In reply to
You can convert your html to entity names so it doesn't mess up the html.

$in{emailmessage} =~ s/</&lt;/g;
$in{emailmessage} =~ s/"/&quot;/g;

Then you can either convert it back before you send the email or send the email as html.

Hope that helps.

Last edited by:

Paul: Jul 1, 2002, 12:39 PM
Quote Reply
Re: [Paul] Help with Send Record Mod In reply to
Beautiful! And much simpler than what I was thinking about doing- (dividing my form up into little forms within CSS layers, one layer hidden, then merging the layers into one form with a javascript Blush)

I changed it a bit. I used $rec{'Review'} because it is my actual field which is long and has html in it. Substituting the <p>'s with two newlines makes the email look a lot nicer too- and solves another problem I was wondering about. Why did my email messages have an exclamation point and newline every 990 characters? I don't have any fields or anything else defined to be limited to that length. With the newlines, this won't happen, unless I have a paragraph longer than 990 characters.

$rec{'Review'} =~ s/<p>/\n\n/g;
$rec{'Review'} =~ s/>/&gt;/g;
$rec{'Review'} =~ s/</&lt;/g;
$rec{'Review'} =~ s/"/&quot;/g;

Thanks for your help Paul. If anyone knows about the 990 thing, I am curious.