|
-
Feb 18th, 2001, 04:02 PM
#1
Thread Starter
Hyperactive Member
I know that nobody here will answer this question, because this is the third time I've tried. But, I like to do this anyway because its such a simple question that you'd expect ANYBODY that had ANY experience at all with Javascript could answer this question without even thinking about it. It's been my experience that it's far more difficult a question than anybody had ever expected or believed possible.
Now, without further ado, the most difficult question in the Universe:
I've got a simple form, nothing fancy, it just sends the data in the fields to an e-mail address via the mailto: in the action attribute. There's just one problem, when the user clicks on the submit button it seems as if nothing happens, so they keep clicking and clicking and clicking unknowingly submitting five or more of the same form. What I need is a javascript that would redirect the user's browser to a specified URL when they click on the submit button.
Sounds simple, doesn't it? Well, think again, because a simple little OnSubmit event handler in the form tag never worked, maybe I wasn't doing it right but I didn't exactly have much help. Same goes for an OnClick in the Submit button.
The race is on, who can answer the most difficult known question in the Universe?
-
Feb 18th, 2001, 04:29 PM
#2
Fanatic Member
Post your code.....
DocZaf
{;->
-
Feb 18th, 2001, 04:36 PM
#3
Thread Starter
Hyperactive Member
There's a problem there, my comp crashed and I couldn't back that up.
Sorry...
-
Feb 18th, 2001, 05:13 PM
#4
Hi,
Instead of using JavaScript why not use ASP, i use asp to submit my forms. You can sign up free asp accounts with www.domaindlx.com. If you are not familiar with asp then i can set it up for u.
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Feb 18th, 2001, 05:53 PM
#5
PowerPoster
i don't know, as i recall, i helped you with the old post, and got it to work, at least in IE, maybe not ns.
or you could just have an alert pop up when you submit the form.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Feb 18th, 2001, 05:58 PM
#6
Fanatic Member
You could try to use a regular "button" and not a "submit" one and call a function to take care of it like this:
<script>
function sendData(){
sendMe.submit();
window.location = '/thanks.html';
}
</script>
<form ID = "sendMe" METHOD = "post" ACTION = "youraction">
...other form stuff
< input TYPE = "button" VALUE = "Submit" ONCLICK = "sendData();">
</form>
By calling submit() this will submit the form and location can then be used to change the current page, just supply the desired URL as a string to it. I haven't tested this out but it should work.
-
Feb 18th, 2001, 07:40 PM
#7
Try this code
Code:
<html>
<head>
<title>Untitled Document</title>
<script>
function submitIt()
{
var temp;
temp=window.open("","noname");
temp.document.write('<h1>Thanks for your email !!</h1>');
}
</script>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="mailto:[email protected]" name="form1">
<p> Name :
<input type="text" name="txtName">
</p>
<p> Email :
<input type="text" name="txtEmail">
</p>
<p>
<input type="submit" name="Suubmit" value="Suubmit" onclick="submitIt()" >
<input type="reset" name="Submit2" value="Reset">
</p>
</form>
</body>
</html>
Or if you can open a html file instead of using document.write. Just use Window.open("filename.htm");
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Feb 18th, 2001, 08:08 PM
#8
Thread Starter
Hyperactive Member
Thank you all, and I'm sorry sail but I do need it to be as completely compatible as possible. Glad to finally get an answer to this question =)
-
Oct 10th, 2001, 06:00 PM
#9
PowerPoster
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Oct 10th, 2001, 09:06 PM
#10
Thread Starter
Hyperactive Member
Did you just search for my name and decide to reply to all my posts?
-
Oct 10th, 2001, 09:27 PM
#11
PowerPoster
I've had that with people, but no, I don't really even notice...
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Oct 11th, 2001, 10:23 AM
#12
Frenzied Member
Okay, this is an untested solution, and I'm not going to rebuild the whole page. You should've atleast done that when someone asked for the code. You will have to do it anyway.
Code:
<a href="JavaScript:GoGoGo();">Send Mail</a>
<script type="text/javascript">
function GoGoGo() {
document.myMailForm.submit();
document.myRedirectForum.submit();
}
</script>
Like I said, I don't know if this will work, but you hopefully see where I'm going with it and you can test it out.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Oct 11th, 2001, 10:25 AM
#13
Frenzied Member
Originally posted by Danial
Instead of using JavaScript why not use ASP, i use asp to submit my forms.
Uhm, no, you don't. ASP is a server side scripting technology. It may dynamicaly create forms, and it may dynamicaly create pages in response to what has been submitted in forms, but it it doesn't actually submit a form.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Oct 12th, 2001, 04:53 AM
#14
Hyperactive Member
Why would you want to submit a form using mailto??
You have to decipher it when the mail arrives!
Code:
select=hello&Submit=Submit
What a nasty way to do things even a free perl/vbscript provider would be better than this method surely!
Anyone else agree?
-
Oct 12th, 2001, 03:38 PM
#15
Originally posted by CiberTHuG
Uhm, no, you don't. ASP is a server side scripting technology. It may dynamicaly create forms, and it may dynamicaly create pages in response to what has been submitted in forms, but it it doesn't actually submit a form.
Yes i know. ASP is a server side technology and know the difference between server side and client side technology, and know what they are capable of !!
I actually meant you could submit the result of the forms to an asp file and process it and use asp to send the email. AS if you use mailto: then the user will have to use their defualt mail client to send the mail and some user dont have it set up in their system, and its pretty annoying some times. So thats why i suggested ASP !!
Hey English has never been my first language
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Oct 12th, 2001, 06:23 PM
#16
Fanatic Member
Ko-Recta-Mundo
Hear Hear
I actually meant you could submit the result of the forms to an asp file and process it and use asp to send the email. AS if you use mailto: then the user will have to use their defualt mail client to send the mail and some user dont have it set up in their system, and its pretty annoying some times. So thats why i suggested ASP !!
DocZaf
{;->
-
Oct 15th, 2001, 06:37 AM
#17
Conquistador
Originally posted by progressive
Why would you want to submit a form using mailto??
You have to decipher it when the mail arrives!
Code:
select=hello&Submit=Submit
What a nasty way to do things even a free perl/vbscript provider would be better than this method surely!
Anyone else agree?
PHP would do this very easily, so would perl
-
Oct 15th, 2001, 06:52 AM
#18
Hyperactive Member
PHP would do this very easily, so would perl
What do you mean da_silvy?
If you meen once you have recieved the mail that was sent to you using the mailto command you could then decipher it using Perl or PHP.
Then i have this question why the hell wouldn't you use Perl or PHP to send it in the first place ??

If you don't meen that then please ellaborate further!
-
Oct 15th, 2001, 10:21 AM
#19
Frenzied Member
Originally posted by Danial
I actually meant you could submit the result of the forms to an asp file and process it and use asp to send the email. AS if you use mailto: then the user will have to use their defualt mail client to send the mail and some user dont have it set up in their system, and its pretty annoying some times. So thats why i suggested ASP !!
I agree with this tactic completely. It keeps your email address of off the page, and avoids problems for user agents that do not have mail clients or POP servers.
I wouldn't submit a mailto form and then a redirect. I would submit to an ASP that passes the address and info to a shell script and then redirects to a second ASP that generates the next page.
But since this is a client scripting forum and he was asking in a for a JavaScript solution....
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Oct 15th, 2001, 04:30 PM
#20
Conquistador
Originally posted by progressive
What do you mean da_silvy?
If you meen once you have recieved the mail that was sent to you using the mailto command you could then decipher it using Perl or PHP.
Then i have this question why the hell wouldn't you use Perl or PHP to send it in the first place ??

If you don't meen that then please ellaborate further!
Sorry progressive, i meant to use Perl or PHP to send it all together
-
Oct 16th, 2001, 05:05 PM
#21
Originally posted by CiberTHuG
But since this is a client scripting forum and he was asking in a for a JavaScript solution....
Well it was an alternative suggestion/solution, like someone else mentioned PHP or Perl. If you look further down my original post, i have posted a Javascript Solution
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Oct 17th, 2001, 02:12 AM
#22
Conquistador
Originally posted by CiberTHuG
But since this is a client scripting forum and he was asking in a for a JavaScript solution....
This is not just a client side scripting forum
XML, HTML, Javascript, Web and CGI
Discuss XML, HTML, Javascript and popular CGI languages here. Topics include: Perl, PHP, Cold Fusion, and more. Note Java, ASP and VB Script have their own forums.
And we were just offerring alternative ideas
-
Oct 17th, 2001, 11:57 AM
#23
Lively Member
Use frontpage's Feedback form. it has some buit in features to do what you want.
Don't ever Ginop before you Ginip 
-
Oct 17th, 2001, 08:12 PM
#24
Thread Starter
Hyperactive Member
Well, I got it figured out, somehow an onclick in the submit button works now. Here's the code:
In the header tag:
Code:
<script>
<!--
function submitIt()
{
var temp;
var tempstring;
tempstring = "<html><head><title>Thanks!</title></head><body text='#006600'><H1 align='center'>Thank you for your email.</H1><body></html>";
temp=window.open("","noname");
temp.document.write(tempstring);
}
-->
</script>
The Submit button:
Code:
<input type="submit" value="Submit" onclick="submitIt()">
I know it's not exactly a browser redirect, but hey, it works just fine )
Thanks for all the help guys!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|