Need to dynamically change the form action depending on radio button selected

Discussion in 'JavaScript' started by brazenmedia, May 31, 2007.

  1. #1
    I need to change the form action depending on which radio button is selected. The catch here is that the form action is using mailto: with an encoding type. I can successfully change the action, but it does not retain the enctype, therefore it does not post the form to the email client. Really all I want to change is the subject part of the mail to line.

    So I have 3 different options for the action line, depending on which is selected for the radio button, that is the one that will submit and create a customized subject line:

    <form method="post" action="mailto:mail@mail.com?subject=Subject1" enctype="text/plain" name="Subject1">

    <form method="post" action="mailto:mail@mail.com?subject=Subject2" enctype="text/plain" name="Subject2">

    <form method="post" action="mailto:mail@mail.com?subject=Subject3" enctype="text/plain" name="Subject3">

    Any ideas?
     
    brazenmedia, May 31, 2007 IP
  2. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Put a onclick action on your radiobuttons.

    onclick="this.form.action=mailto:mail@mail.com?subject=Subject1;"
    onclick="this.form.action=mailto:mail@mail.com?subject=Subject2;"
    onclick="this.form.action=mailto:mail@mail.com?subject=Subject3;"
     
    wing, May 31, 2007 IP