Help with mailto: and form results in message body

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • G. Morgan

    Help with mailto: and form results in message body

    I don't have access to a server-side solution, so I guess Javascript
    is my only choice.

    I want to pass a bunch of form fields to an email, but unsure of how
    to add the multiple fields into the body section.

    What I want to add is the "dropdown" data merged into the body of the
    email.
    I found this example code (that works just the way I want it to,
    except I want to add more data).
    My changes are below it:

    <script>
    function now()
    {
    var thebody=documen t.testform.theb ody.value;
    window.location .href="mailto:s omeone@invalid. com?subject=Mai l
    Test&body=" +
    escape(thebody) ;
    }
    </script>
    <form name=testform>
    <input type=button value="click me" onclick="now()" >
    <textarea name=thebody>
    This is test email body data.
    </textarea>
    </form>


    ----------------------------------
    My changes
    ----------------------------------
    <script>
    function now()
    {
    var thebody=documen t.testform.theb ody.value;
    var dropdown=docume nt.testform.dro pdown.value;
    window.location .href="mailto:s omeone@invalid. com?subject=Mai l
    Test&body=" +
    (thebody)+(drop down);
    }
    </script>
    <form name=testform>
    <input type=button value="click me" onclick="now()" >
    <textarea name=thebody>
    This is test email body data.
    </textarea>

    <select size="1" name="dropdown" >
    <option>yes</option>
    <option>no</option>
    </select></form>
  • Thomas 'PointedEars' Lahn

    #2
    Re: Help with mailto: and form results in message body

    G. Morgan wrote:
    I don't have access to a server-side solution,
    Get one.
    so I guess Javascript is my only choice.
    >
    I want to pass a bunch of form fields to an email, but unsure of how
    to add the multiple fields into the body section. [...]
    Client-side scripting is not going to provide an equivalent solution here.


    PointedEars
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

    Comment

    Working...