Gossamer Forum
Home : Products : DBMan : Customization :

Private mailing quest

Quote Reply
Private mailing quest
 
I'm using Carol's snippet for not showing e-mail field, but mailing from form instead, but I'd like to add a quest for the user (when adding a record) like do you want your e-mail to be private.

If the user choose 'yes' then when showing record, it'll be shonw with mail snippet, and if not, it'll be shown reguraly (mailto:some@host.com).

So I know I have to add another field isPrivate, but how to put it all together...

Carol ?!?

Tnx...
Quote Reply
Re: Private mailing quest In reply to
I was afraid the code I gave you before wasn't working! Glad to know that it's just a further question. Smile

Yep. Add your "isPrivate" field to the database. Then make an if statement in html_record:

Code:
|; # close off previous print statement
if ($rec{'isPrivate'} ) {
print qq| [whatever you're printing out to do the private mailing thing] |;
}
else {
print qq|<a href="mailto:$rec{'Email'}">$rec{'Email'}</a>|;
}

I'm assuming that your "isPrivate" field is a checkbox. That's the easiest way to set it up.


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





Quote Reply
Re: Private mailing quest In reply to
Tnx Carol, fast and accurate as always... ;-)

It won't work with me... so, I used lenght check...
if (length($rec{'fieldnname'})>7) {
print qq|<a href="$db_script_link_url&$db_key=$rec{$db_key}&show_pic=1"><img src="$slikaslika" valign="middle" border="0"></a>|;
}


But I have another question for you... I want to include another check in the above routine so the code will be executed only if both conditions are satisfied...

something like if (lenght($rec(A)>7) and (lenght($rec(B)>3) {
}
else {
}

Tnx in advance...

Quote Reply
Re: Private mailing quest In reply to
Code:
if ((length($rec{'A'}>7) && (length($rec{'B'}>3)) {
[do something]
}
else {
[do something different]
}


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





Quote Reply
Re: Private mailing quest In reply to
I got this to work...However, I was wondering what the appropriate codes would be if there is NO email address.

Here is what I have working:

1) Set up a radio button field: Permission
(with Yes and No values)

2) Set up another field: Email (Not required)

3) Add the following code into the html_record_long sub-routine:

Code:
if ($rec{'Permission'} eq 'Yes') {
print qq|<$font><b>Email:</b> <a href="mailto:$rec{'Email'}">$rec{'Email'}</a></font><br>|;
}
else {
print qq|<$font><b>Email:</b> <a href="$db_script_link_url&$db_key=$rec{$db_key}&send_email_form=1">Send Message</a></font>|;
}

What codes do you insert if there is NO email address in the email address field? I know that the send_email sub-routine checks the record and if there is no email address, then it returns an error message. But I was wondering if a third option can be added based on the Permission and Email fields.

The three options would be:

1) Print Email Address if there is an email address and if the user "checks" Yes.

2) Show Send Email Message Form if there is an email address and if the user "checks" No.

3) Shows nothing if there is no email address and if the Permission is set to No.

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
Quote Reply
Re: Private mailing quest In reply to
Code:
if (($rec{'Permission'} eq 'Yes') && $rec{'Email'})) {
print qq|<$font><b>Email:</b> <a href="mailto:$rec{'Email'}">$rec{'Email'}</a></font><br>|;
}
elsif ($rec{'Email'}) {
print qq|<$font><b>Email:</b> <a href="$db_script_link_url&$db_key=$rec{$db_key}&send_email_form=1">Send Message</a></font><br>|;
}

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





Quote Reply
Re: Private mailing quest In reply to
Thanks, Carol...

I was missing the && $rec{'Email'} code.

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
Quote Reply
Re: Private mailing quest In reply to
Thanks, Carol. It worked. However, there was a minor syntax problem with the codes you provided.

It should read:

Code:
if (($rec{'Permission'} eq 'Yes') && $rec{'Email'}) {
print qq|<$font><b>Email:</b> <a href="mailto:$rec{'Email'}">$rec{'Email'}</a></font><br>|;
}
elsif ($rec{'Email'}) {
print qq|<$font><b>Email:</b> <a href="$db_script_link_url&$db_key=$rec{$db_key}&send_email_form=1">Send Message</a></font><br>|;
}

Notice that there should only be one ) on the first line.

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
Quote Reply
Re: Private mailing quest In reply to
Thank you, Eliot. Actually, what I had intended was to use

if (($rec{'Permission'} eq 'Yes') && ($rec{'Email'})) {

The result is the same, but it's more symmetrical. Smile


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