Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Wed Jan 07, 2009 9:05 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Mailto: multiple options
PostPosted: Thu Oct 04, 2007 9:39 pm 
Offline

Joined: Thu Oct 04, 2007 2:07 pm
Posts: 6
Sorry I am not familiar with Javascript but I was recommended to try here with my question. I am trying to use the mailto: feature in forms but I want to be able to have an option of letting the user chose to whom
the email will be sent. Is this available in Java?

See here for my original thread:
mailto-question-vt8117.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 04, 2007 10:41 pm 
Offline
50+ Club
User avatar

Joined: Fri Aug 24, 2007 9:38 pm
Posts: 85
Location: hawaii or bust
you need a select<select> form element to create a dropdown list for the user to choose the recipient, then get the value of the selected option and change the action of the form to that by concatenating a string. based on the selected value.

document.forms[0].action = ("mailto:" + document.forms.selector.options[document.forms.selector.selectedIndex].value);



<select name="selector">
<option value="secretagent@cia.gov">secretagent@cia.gov</option>
</select>



I believe that should get the job done didn't check the code so there may be an error or 2


:wink:



also you do realize that mailto does not actually send an email?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 3:53 pm 
Offline

Joined: Thu Oct 04, 2007 2:07 pm
Posts: 6
I don't know if that code will work because the “selector” cannot be applied to the first line of code when the page loads up because the user hasn’t had a chance to select the e-mail address yet.

I have received other opinions that"


Quote:
If there is any sort of “option” to select, there needs to be an “action” to process the option. The action is usually a button… The only way I can see you doing this is have some sort of form that has a pull down menu. The pull down menu will allow you to select the e-mail recipient and the action on the form would be the mailto… see if that works.



Anybody know how to do this...? Sorry I am just a hobbiest and am learning everything through trial and error.
[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 4:06 pm 
Offline
100+ Club
User avatar

Joined: Fri Apr 08, 2005 8:32 am
Posts: 179
Location: India
Hey you can never mail using HTML/Javascript, You'll need to use PHP os ASP(dont use this), So now in PHP you'll have to specify a server that'll act as a mail server(dont worry many servers are available), the recepient, and sender and there are other options also..


http://in.php.net/function.mail

this link should tell you all about it..
And its very easy to do it.

_________________
--------DAFUNKYMUNKY--------
::THE::NECESSARY::[D]EVIL::
....errr i mean munky....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 8:57 pm 
Offline
50+ Club
User avatar

Joined: Fri Aug 24, 2007 9:38 pm
Posts: 85
Location: hawaii or bust
OK go back to my first post on the page,

in the body of the html document you need a drop down select list right?

well thats what a select element is, it's a wrapper around a group of options
this should be written first

<select name="selector" onchange="changeAction()">
<option value="secretagent@cia.gov" defaultSelected="true">secretagent@cia.gov</option>
</select>


again this code should come before any code that references it in line(outside of a function)


you'll see the onchange event handler in the select element tag
which calls a function, this function will be called whenever the selection
option changes(when a new email address is selected) the function changeAction is wriiten below



<script language="javascript">

function changeAction() {
document.forms[0].action = ("mailto:" + document.forms.selector.options[document.forms.selector.selectedIndex].value);
}


</script>



again I did not test any of this, but this is the procedure you need to take
for what you are talking about doing. as for mailing the actual email look into the php mail() function


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 5:19 pm 
Offline

Joined: Thu Oct 04, 2007 2:07 pm
Posts: 6
Okay I understand the idea but not how to actually do it.

here is an example form, how do you add a drop down?

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<FORM METHOD="POST" ACTION="mailto:test@test.com" enctype="text/plain">
<p>1.What colour is the sky?</p>
<p>
<textarea name="1" id="1" cols="80" rows="5"></textarea>
</p>
<p>
<INPUT TYPE=submit>
<INPUT TYPE=reset>
</p>
</FORM>
</body>
</html>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: