HighDots Forums  

Passing textbox value on coldfusion form to mailto tag

Javascript JavaScript language (comp.lang.javascript)


Discuss Passing textbox value on coldfusion form to mailto tag in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jnag
 
Posts: n/a

Default Passing textbox value on coldfusion form to mailto tag - 12-28-2007 , 02:52 PM






Hi,

I have a text field on a coldfusion form in which the user
enters an email address. Next to the text field, there is a link
called "Email". If the user clicks this link, an outlook window
should popup with the email address from the text field
populated in the To field. The outlook window pops up, but
does not get populated with the email address. Can you
please give me some suggestions?

I am trying to do it this way:

<a href="mailto:javascript:document.mainInputForm.ema il_address.value"
target=""><b>Email</b></a>

Thanks,
jn

Reply With Quote
  #2  
Old   
Randy Webb
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-28-2007 , 03:27 PM






jnag said the following on 12/28/2007 3:52 PM:
Quote:
Hi,

I have a text field on a coldfusion form in which the user
enters an email address.
Oh boy, this should be fun.

Quote:
Next to the text field, there is a link called "Email". If
the user clicks this link, an outlook window should popup
with the email address from the text field populated in
the To field.
And if the user has enough common sense not to have Outlook on the
computer? Or, has a different email program set up as the default? Or,
doesn't have a default email program set up?

Quote:
The outlook window pops up, but does not get populated with the
email address. Can you please give me some suggestions?
Yeah, stop using the mythical mailto: protocol, it isn't reliable.
<URL: http://www.isolani.co.uk/articles/mailto.html>

Quote:
I am trying to do it this way:

a href="mailto:javascript:document.mainInputForm.ema il_address.value"
target=""><b>Email</b></a
Sheesh. If you guess enough, without figuring out what you are doing,
you might just get lucky. Probably not though.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #3  
Old   
David Dorward
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-28-2007 , 04:31 PM



On Dec 28, 9:27 pm, Randy Webb <HikksNotAtH... (AT) aol (DOT) com> wrote:
Quote:
jnag said the following on 12/28/2007 3:52 PM:

The outlook window pops up, but does not get populated with the
email address. Can you please give me some suggestions?

Yeah, stop using the mythical mailto: protocol, it isn't reliable.
URL:http://www.isolani.co.uk/articles/mailto.html
Mike's article, while excellent, discusses the use of mailto: as a
form action, not an anchor's href. Using
href="mailto:example (AT) example (DOT) com" is quite sensible.

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/


Reply With Quote
  #4  
Old   
David Dorward
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-28-2007 , 04:38 PM



On Dec 28, 8:52 pm, jnag <prajy... (AT) gmail (DOT) com> wrote:
Quote:
I have a text field on a coldfusion form in which the user
Coldfusion isn't involved in your example.

Quote:
enters an email address. Next to the text field, there is a link
called "Email". If the user clicks this link, an outlook window
should popup with the email address from the text field
populated in the To field.

The following is garbage for a number of reasons:

* It doesn't work without JavaScript
* It doesn't work with webmail under most circumstances
* It is a pointless exercise in moving the To field from the email
client into the webbrowser - user's can just switch to the email
client.

That said, the following should, theoretically (I'm not going to test
this since its a pointless exercise), work (some of the time):

<form action="fallback.html" onclick="document.location='mailto:' +
this.elements.address.value; return false;">
<div>
<input name="address"><input type="submit" value="Email">
</div>
</form>

You can mitigate the issue of dependence on JavaScript by performing
an HTTP redirect to mailto: and then the address (this would require
something, such as Coldfusion, running on the server, at the URI
specified in the action attribute).

It is still a pointless exercise though. If you are trying to solve
the problem of people not knowing how to use their email client, then
train them, don't try to create an interface that, once learned, isn't
going to help them when they use a different system.

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/


Reply With Quote
  #5  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-28-2007 , 04:43 PM



David Dorward wrote:
Quote:
On Dec 28, 9:27 pm, Randy Webb <HikksNotAtH... (AT) aol (DOT) com> wrote:
jnag said the following on 12/28/2007 3:52 PM:
The outlook window pops up, but does not get populated with the
email address. Can you please give me some suggestions?

Yeah, stop using the mythical mailto: protocol, it isn't reliable.
URL:http://www.isolani.co.uk/articles/mailto.html

Mike's article, while excellent, discusses the use of mailto: as a
form action, not an anchor's href. Using
href="mailto:example (AT) example (DOT) com" is quite sensible.
Actually, it is almost as bad. For example, consider an Internet café where
there would be no local e-mail client be installed or if it was, most
certainly it was not configured or the configuration be allowed to be
changed. And if that example is too far-fetched for you, consider users of
GMail or other Web mail services which would seldom use a local MUA.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee


Reply With Quote
  #6  
Old   
Randy Webb
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-28-2007 , 05:41 PM



David Dorward said the following on 12/28/2007 5:31 PM:
Quote:
On Dec 28, 9:27 pm, Randy Webb <HikksNotAtH... (AT) aol (DOT) com> wrote:
jnag said the following on 12/28/2007 3:52 PM:

The outlook window pops up, but does not get populated with the
email address. Can you please give me some suggestions?

Yeah, stop using the mythical mailto: protocol, it isn't reliable.
URL:http://www.isolani.co.uk/articles/mailto.html

Mike's article, while excellent, discusses the use of mailto: as a
form action, not an anchor's href.
One is just as bad as the other.

Quote:
Using href="mailto:example (AT) example (DOT) com" is quite sensible.
It is quite sensible if, and only if, you control the environment in
which it is going to be executed. That is not the case on the WWW and
mailto:, whether an action or an href, is a good recipe for disaster if
you actually want to receive correspondence from your website.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #7  
Old   
David Dorward
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-29-2007 , 02:03 AM



On Dec 28, 10:43 pm, Thomas 'PointedEars' Lahn <PointedE... (AT) web (DOT) de>
wrote:
Quote:
Mike's article, while excellent, discusses the use of mailto: as a
form action, not an anchor's href. Using
href="mailto:exam... (AT) example (DOT) com" is quite sensible.

Actually, it is almost as bad. For example, consider an Internet café where
there would be no local e-mail client be installed or if it was, most
certainly it was not configured or the configuration be allowed to be
changed. And if that example is too far-fetched for you, consider users of
GMail or other Web mail services which would seldom use a local MUA.
While there are users who it won't work for, it doesn't cause effects
that are anywhere near as broken as that of trying to use it as an
action in a form. A number of browsers even have explicit "Copy email
address" functionality on the context menu, which gets around the
issue of webmail clients (as do tools such as
http://lifehacker.com/software/gmail...ion-251923.php
which make mailto links work with webmail clients). Additionally, a
mailto link that is formatted according to the usual conventions gives
strong enough hints that it wants to open in an email client that
relatively few users will be confused (unlike a form where there are
no conventions to indicate that it uses mailto).

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/


Reply With Quote
  #8  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-29-2007 , 07:14 AM



David Dorward wrote:
Quote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Mike's article, while excellent, discusses the use of mailto: as a
form action, not an anchor's href. Using
href="mailto:exam... (AT) example (DOT) com" is quite sensible.

Actually, it is almost as bad. For example, consider an Internet café
where there would be no local e-mail client be installed or if it was,
most certainly it was not configured or the configuration be allowed to
be changed. And if that example is too far-fetched for you, consider
users of GMail or other Web mail services which would seldom use a
local MUA.

While there are users who it won't work for, it doesn't cause effects
that are anywhere near as broken as that of trying to use it as an action
in a form.
Yes, it does. While it would not cause the user to fill out a Web form and
then end up with an empty e-mail, it does cause users to write an e-mail
that eventually cannot be sent, without even an indication before they click
the `Send' button that this might happen. If, and only if, there is an
e-mail application installed *and* registered in the HTML user agent to
handle `mailto:' URIs.

Quote:
A number of browsers even have explicit "Copy email address"
functionality on the context menu, [...]
I don't know any non-developer (and I know not few) who would be aware of
that feature. Besides, you jump to conclusions here.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16


Reply With Quote
  #9  
Old   
Randy Webb
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 12-30-2007 , 07:11 PM



David Dorward said the following on 12/29/2007 3:03 AM:
Quote:
On Dec 28, 10:43 pm, Thomas 'PointedEars' Lahn <PointedE... (AT) web (DOT) de
wrote:
Mike's article, while excellent, discusses the use of mailto: as a
form action, not an anchor's href. Using
href="mailto:exam... (AT) example (DOT) com" is quite sensible.

Actually, it is almost as bad. For example, consider an Internet café where
there would be no local e-mail client be installed or if it was, most
certainly it was not configured or the configuration be allowed to be
changed. And if that example is too far-fetched for you, consider users of
GMail or other Web mail services which would seldom use a local MUA.

While there are users who it won't work for, it doesn't cause effects
that are anywhere near as broken as that of trying to use it as an
action in a form.
One is just as broken as the other.

Quote:
A number of browsers even have explicit "Copy email
address" functionality on the context menu, which gets around the
issue of webmail clients
Where can I find this in a context menu? In a default setting.

Quote:
(as do tools such as
http://lifehacker.com/software/gmail...ion-251923.php
which make mailto links work with webmail clients).
So, it is ok to use a broken mailto: link because people can use
additional software to get the functionality? Sounds like a good
argument for making scripting required on a website.

Quote:
Additionally, a mailto link that is formatted according to the
usual conventions gives strong enough hints that it wants to open
in an email client that relatively few users will be confused
(unlike a form where there are no conventions to indicate that
it uses mailto).
So, if I copy the site I referred to, change all the mailto: form parts
to refer to mailto: href's, then there wouldn't be a problem referring
to it?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #10  
Old   
David Dorward
 
Posts: n/a

Default Re: Passing textbox value on coldfusion form to mailto tag - 01-03-2008 , 09:03 AM



On Dec 31 2007, 1:11 am, Randy Webb <HikksNotAtH... (AT) aol (DOT) com> wrote:
Quote:
While there are users who it won't work for, it doesn't cause effects
that are anywhere near as broken as that of trying to use it as an
action in a form.

One is just as broken as the other.
When a link is clicked, if it doesn't work, then it doesn't work.

When a form is submitted, if it doesn't work, then the work done in
entering the data into it is mostly wasted.

That's a significant difference.

Quote:
A number of browsers even have explicit "Copy email
address" functionality on the context menu, which gets around the
issue of webmail clients

Where can I find this in a context menu? In a default setting.
Firefox at the very least.

Quote:
So, it is ok to use a broken mailto: link because people can use
additional software to get the functionality? Sounds like a good
argument for making scripting required on a website.
As mentioned, it will work just fine for most users, and doesn't cause
any significant problems for other users (who can copy/paste the
address).

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.