Results 1 to 3 of 3

Thread: mailto selected recipients

  1. #1
    Join Date
    Mar 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default mailto selected recipients

    Ok. So I am making a website for my company but we are not on a server. It is just a localized drive that everyone has access to so I cannot use PHP and other server side scripts. I am making a mailto form, which is not the problem. I would like to see if I can make a single form that has a dropdown for the person to choose the recipient of the email. I have made multiple forms for each individual recipients but we are trying to conserve space.
    In the example below I am wanting the Manager dropdown to choose the recipient. Are there any ideas out there?

    [CODE]
    <FORM name=ButtonNominations onsubmit="return checkrequired(this)"
    action="mailto:me@example.com?subject=Nomination" method=post encType=text/plain>


    <table cellspacing="10px" width="90%">
    <tr>

    <td width="150px">
    <LABEL for=requiredNameofNominee>Who are you Nominating?</LABEL></td>

    <td>
    <INPUT name=requiredNameofNominee><br />
    </td>

    <td>
    &nbsp;
    </td>

    <td><LABEL for=requiredManager>Manager of Nominee</LABEL></td>

    <td><SELECT name=requiredManager> <OPTION selected>
    <OPTION>Manager 1</OPTION>
    <OPTION>Manager 2</OPTION>
    <OPTION>Manager 3</OPTION>
    <OPTION>Manager 4</OPTION>
    <OPTION>Manager 5</OPTION>
    <OPTION>Manager 6</OPTION>
    <OPTION>Manager 7</OPTION>
    <OPTION>Manager 8</OPTION>
    <OPTION>Manager 9</OPTION>
    </SELECT><br />
    </td>

    </tr>


    <tr>
    <td>
    <LABEL for=requiredNominatedBy>Your Name:</LABEL></td>
    <td>
    <INPUT name=requiredNominatedBy><br /></td>

    <td>&nbsp;</td>
    <td><LABEL for=requiredRESEND>Do you want to read this nomination out loud at the department meeting?</LABEL>
    </td>

    <td>
    <INPUT
    name="read" value="Yes" type="radio"> <LABEL for=read>Yes</LABEL>
    <INPUT
    name="read" value="No" type="radio"> <LABEL for=read>No</LABEL>
    <br />
    </td>

    </tr>

    <tr>

    <td colspan="2">
    <LABEL for=requiredINFORMATION><i>More Info:</i></LABEL><br />
    <TEXTAREA id=requiredINFORMATION name=requiredINFORMATION rows=6 cols=50></TEXTAREA><br />
    </td>

    <td colspan="3">
    <br />
    <FIELDSET><LEGEND align=top>Button Nominated For</LEGEND>
    <br>

    <INPUT id=applause type=radio value=applause
    name=button> <LABEL for=applause>Applause, Applause</LABEL> <BR>

    <INPUT id=difference type=radio value=difference
    name=button> <LABEL for=difference>You Make the Difference</LABEL> <BR>

    <INPUT id=team type=radio value=team
    name=button> <LABEL for=team>Together Everyone Achieves More</LABEL>
    </fieldset>
    <br />

    </td>


    </tr>



    <tr>

    <td colspan="2">
    <INPUT type=submit value=Submit>
    &nbsp;
    <INPUT type=reset value=Cancel>
    </td>

    <td colspan="3">
    <FONT color=red><strong>After pressing 'submit', a pop-up box will let you know the form is being
    submitted using e-mail - Click OK.
    Another pop-up will ask you again if you
    want to send via email - Click Allow.</strong></FONT>
    </td>
    </table>

    </FORM>

    [CODE]

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    My idea would be to make the form action a javascript value and have the value be set by the user's action in the form. Not that good at javascript though so not sure if this'd work or not sorry.
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Mar 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Great. Thanks for your suggestion. After some extensive research and alterations I finally got it to work with Javascript.
    (Obviously I have changed the name of the form and altered some other data that needed to be changed for the purpose of the form.)

    [CODE]
    <SCRIPT LANGUAGE="JavaScript">
    <!--

    function mailIt(form) {
    var data = document.dataForm
    var userInfo = ""

    // comment out the next line if you want to hardcode the reciepient
    // then add 'foo@bar.com' to the 'mailform' action attribute
    // (i.e. -- ACTION="mailto:foo@bar.com")
    form.action += data.recipient.value

    // comment out the next line if you want to hardcode the subject
    // then add '?subject=example' to the 'mailform' action attribute.
    // You must hardcode an address before you can hardcode a subject.
    // (i.e. -- ACTION="mailto:foo@bar.com?subject=example")
    form.action += "?subject=" + data.subject.value




    form.Name.value = userInfo + data.Name.value
    form.Dates.value = userInfo + data.Dates.value
    form.PartialorFull.value = userInfo + data.PartialorFull.value
    form.HoursTaken.value = userInfo + data.HoursTaken.value
    form.PartialDayTime.value = userInfo + data.PartialDayTime.value
    form.BenefitTime.value = userInfo + data.BenefitTime.value
    form.MakingUpTime.value = userInfo + data.MakingUpTime.value
    form.Reason.value = userInfo + data.Reason.value
    return true
    }
    // -->
    </SCRIPT>
    [CODE]

    Then I just made the form as normal with the dropdown options each having the respective email address as the value and then add one more form for the email context to be sent.

    [CODE]
    <FORM
    NAME="mailForm"
    ACTION="mailto:"
    METHOD="post"
    ENCTYPE="text/plain"
    onSubmit="return mailIt(this)">

    <INPUT TYPE="hidden" NAME="Name" VALUE="">
    <INPUT TYPE="hidden" NAME="Dates" VALUE="">
    <INPUT TYPE="hidden" NAME="PartialorFull" VALUE="">
    <INPUT TYPE="hidden" NAME="HoursTaken" VALUE="">
    <INPUT TYPE="hidden" NAME="PartialDayTime" VALUE="">
    <INPUT TYPE="hidden" NAME="BenefitTime" VALUE="">
    <INPUT TYPE="hidden" NAME="MakingUpTime" VALUE="">
    <INPUT TYPE="hidden" NAME="Reason" VALUE="">

    <TR>
    <TD>
    <INPUT TYPE="submit" VALUE="Send Request">
    </TR>
    </FORM>
    [CODE]

    Each of the hidden inputs is just to put the answer to each question on the form in the email.
    Thanks again.

Bookmarks

Posting Permissions

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