PDA

View Full Version : mailto


hughesmi
09-12-2002, 02:40 PM
Please can someone help?

I have a simple form that uses the "mailto" to send the info.
Not practical I know, but the problem I have is once the form has been validated and the user goes to submit the info, they are alert by the message to say that your are about to send info by email.


Firstly can this message be eliminated? or the problem I have is when the cancel button is click the info that is type in the form is lost

is there a way round this?

zoobie
09-12-2002, 04:26 PM
The message can't be eliminated because it's a security issue but you can work around it by using, perhaps, a form redirection service like Bravenet.com (free) or another language like PHP (requires PHP host). :D

sjc_unique
09-12-2002, 07:04 PM
hey " hughesmi",

i have just designed a form using php, because i had the same problem with html. it's fairly easy, if u dont know php, u can just put the code in the page, and adapt the obvious areas. have included it below. (I actually got help for this from the php forum! lol)

<?
if(!isset($submit)){
?>
<form action="<?=$PHP_SELF.'?'.$QUERY_STRING?>" method="post">
<input type="text" name="name">

<input type="text" name="email">

<input type="submit" value="Submit" name="submit">
</form>
<?
}else{
$myemail = "you@yourdomain.co.uk";
$subject = "You have a message from $name";
$body = "$name has sent you the following information.


His/her email is: $email";
mail($myemail,$subject,$body,"From: $email");
}
?>



SJC
__________________

Contraban.co.uk is launched! (http://www.mediresponse.co.uk/Contraban/index.php)

zoobie
09-12-2002, 08:55 PM
Oh dear... http://www.stopstart.fsnet.co.uk/smilie/lol.gif

umm
09-12-2002, 10:22 PM
This might help. It won;t eliminate the security alert (as far as I know, it can't be done with the mailto link).


<script language="javascript" type="text/javascript">
<!--
function validate(form){
if(form.email.value==""){
alert("email is a Required Field");
form.email.focus();
return false;
} else
if(form.comments.value==""){
alert("Comments is a Required Field");
form.comments.focus();
return false;
}
return (confirm("Is this Correct\rEmail Address: "+form.email.value))? true: false;
}
//-->
</script>


..with this form...

<form action="mailto:blah@blah.net" enctype="text/plain" method="post" onsubmit="return validate(this)">

<table width="50%" border="1" align="center">

<tr>
<th><label for="emailAddress">Email Address</label></th>
<td><input type="text" name="email" id="emailAddress"></td>
</tr>

<tr>
<th><label for="commentsArea">Comments</label></th>
<td>
<textarea name="comments" id="commentsArea" cols="30" rows="5"></textarea>
</td>
</tr>

<tr>
<th>Submission</th>
<td align="center">
<input type="submit" value="Send">
<input type="reset" value="Clear">
</td>
</tr>

</table>
</form>

hughesmi
09-13-2002, 09:40 AM
This might be a soultion for me, but how I make the

return (confirm("Is this Correct\rEmail Address: "+form.email.value))? true: false;
}

work to display all the required fields?


I have tryed to make it work.

code:-----------------------------------------------------------------------------
<script language="javascript" type="text/javascript">
<!--
function validate(form){
if(form.email.value==""){
alert("email is a Required Field");
form.email.focus();
return false;
} else
if(form.comments.value==""){
alert("Comments is a Required Field");
form.comments.focus();
return false;
}
return (confirm("Is this Correct\rEmail Address: "+form.email.value))? true: false;
}
//-->
</script>
--------------------------------------------------------------------------------


..with this form...

<form action="mailto:blah@blah.net" enctype="text/plain" method="post" onsubmit="return validate(this)">

<table width="50%" border="1" align="center">

<tr>
<th><label for="emailAddress">Email Address</label></th>
<td><input type="text" name="email" id="emailAddress"></td>
</tr>

<tr>
<th><label for="commentsArea">Comments</label></th>
<td>
<textarea name="comments" id="commentsArea" cols="30" rows="5"></textarea>
</td>
</tr>

<tr>
<th>Submission</th>
<td align="center">
<input type="submit" value="Send">
<input type="reset" value="Clear">
</td>
</tr>

</table>
</form>

umm
09-13-2002, 10:18 AM
well, the technique we use will depend on what type of information the fields contain. For example, if you had a textarea for comments, the potential length of the field might make displaying that information in a confirm dialogue unweildy. You might want to go for a popup window in that case and submit or cancel from there.

On the other hand, if you want to confirm small fields like email address, a dialogue may be sufficent.

What fields will you want to display and how long will they potentially be?

Anyway, try out the confirm with some more values:



function validate(form){
if(form.email.value==""){
alert("email is a Required Field");
form.email.focus();
return false;
} else
if(form.comments.value==""){
alert("Comments is a Required Field");
form.comments.focus();
return false;
}
var msg="Is this Correct"
msg+="\rEmail Address: "+form.email.value
msg+="\rComments: "+form.comments.value
return (confirm(msg))? true: false;
}



try that script with the same form as before. Put plently of comment in the "comments" textarea to see what you think.

c1lonewolf
09-21-2002, 07:07 AM
there is a way around the all your text field clearing when you click cancel.
Example
http://www.freewebs.com/dhcs/funmail/funmail.html

simple script manipulation.