Results 1 to 2 of 2

Thread: need help passing option value to hidden value

  1. #1
    ld1084 Guest

    need help passing option value to hidden value

    Hello,

    This is prob. a simple thing, I need to know how to update the hidden field, so when the user selects a person from the drop down, that selected user's email address will pass through to the asp script for email.

    Thanks in advance.

    -=Larry=-

    Code:
    <html>
    <div align="center">
      <center>
      <table border="0" cellpadding="5" width="55%">
        <tr>
          <td width="100%" bgcolor="#DADADA">
    <form action="scripts/formmail.asp" method="POST">
      <td width="65" height="13" class="subtitle">Supervisor</td>
    
    
                            <td height="13" class="textbluedk"><select name="Supervisor" id="select">
    			
                              <option value="1@email.com">User 1</option>
                              <option value="2@email.com">User 2</option>
                              <option value="3@email.com">User 3</option>
                              <option value="4@email.com">User 4</option>
                              <option value="5@email.com">User 5</option>
                              <option value="6@email.com">User 6</option>
                              <option value="7@email.com">User 7</option>
                            </select>
                            </td>
    
    <input type="text" name="textfield">
    <p>
    <font face="Verdana" size="2">
    <input type="submit" value="Submit">
    <input type="reset" value="Clear">
    <br>
    </font>
    </p>
    <input type="hidden" name="_fieldOrder" value="MessageType,Subject,Comments,Name,Email,Telephone,Fax,ContactRequested">
    
    <input type="hidden" name="recipient" value="recipient">
    <input type="hidden" name="_subject" value="ASP FormMail Test Form">
    </form>
          </td>
        </tr>
      </table>
      </center>
    </div>
    </blockquote> 
    </body> 
    </html>

  2. #2
    Join Date
    May 2009
    Location
    England
    Posts
    165
    Hello,

    Try here for an explanation:

    http://www.codeproject.com/KB/scripting/autoselect.aspx

    It's a mix of using onChange for your dropdown form (you need a blank, null value as the default option) and the array of the dropdown and selectedIndex.

    You can feed that value into your form using something like

    document.getElementById('idName').value = x

    where idName is the ID of your input box (hidden or not, it doesn't matter) and x is the output from your onChange.

    I hope that helps.

    Regards,


    David

Similar Threads

  1. hidden control problem in IE 7.0
    By sghsgm in forum General Questions
    Replies: 0
    Last Post: 27 Oct 2008, 06:17 AM
  2. posting hidden form data to a popup window
    By simora in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 26 May 2007, 03:47 AM
  3. Printing elements hidden by JavaScript
    By Anastasia in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 09 Jan 2006, 12:30 PM

Posting Permissions

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