Results 1 to 24 of 24

Thread: I Guarantee Nobody Here Can Answer This Question!

  1. #1

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    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?
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  2. #2
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    Post your code.....

    DocZaf
    {;->

  3. #3

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    There's a problem there, my comp crashed and I couldn't back that up.
    Sorry...
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    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 :

  5. #5
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    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

  6. #6
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    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.
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  7. #7
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    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 :

  8. #8

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    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 =)
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  9. #9
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    42
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  10. #10

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    Did you just search for my name and decide to reply to all my posts?
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  11. #11
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205


    I've had that with people, but no, I don't really even notice...

    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  12. #12
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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.

  13. #13
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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.

  14. #14
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    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?

  15. #15
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    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 :

  16. #16
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554

    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
    {;->
    DocZaf
    {;->

  17. #17
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    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

  18. #18
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    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!

  19. #19
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    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.

  20. #20
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    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

  21. #21
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    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 :

  22. #22
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    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

  23. #23
    Lively Member Crazy_bee's Avatar
    Join Date
    Jul 2001
    Location
    Fitchburg
    Posts
    90
    Use frontpage's Feedback form. it has some buit in features to do what you want.
    Don't ever Ginop before you Ginip

  24. #24

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268
    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!
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width