html5 - Mailto:subject age old query -
i have question , think know answer.
have html code im using action="mailto: function.
my question can assign subject generated email selection in code below? e.g. subject: urgent; when urgent selected.
<head> <title></title> </head> <body> <form enctype="text/plain" method="post" id="orderform" action="mailto:randomeemail@gmail.com?subject" > <table border="1" align="left" style="width: 100%"> <tbody>`enter code here` <tr> <td style="text-align: justify;"><label for="element_10" class="deliverys">what type of delivery required?</label></td> <td style="text-align: justify;"> <select name="urgency required"> <option value="standard">standard delivery</option> <option value="fast">fast</option> <option value="urgent">urgent</option> <option value="required in 4 hours">required in 4 hours</option> <option value="required in 2 hours">required in 2 hours</option> <option value="pick-up">pick-up</option> </select> </td> </tr> <input type="submit" value="submit" name="submit" /> </form> </body> </html>
if don't mind using javascript, can following:
<script> function myfunction(){ window.location.href = 'mailto:randomeemail@gmail.com?subject=' + document.queryselector('select[name="urgency required"]').value return false } </script> <form enctype="text/plain" method="post" id="orderform" onsubmit="return myfunction();" > <table border="1" align="left" style="width: 100%"> <tbody>`enter code here` <tr> <td style="text-align: justify;"><label for="element_10" class="deliverys">what type of delivery required?</label></td> <td style="text-align: justify;"> <select name="urgency required"> <option value="standard">standard delivery</option> <option value="fast">fast</option> <option value="urgent">urgent</option> <option value="required in 4 hours">required in 4 hours</option> <option value="required in 2 hours">required in 2 hours</option> <option value="pick-up">pick-up</option> </select> </td> </tr> <input type="submit" value="submit" name="submit"></input> </tbody> </table> </form>
bascially, when form submits, it'll dynamically generate mailto link, , open it. returns false, stops form submitting (i.e. redirecting action).
Comments
Post a Comment