Can't Add Email To List Box Or Send Email List To Server - Pls. Help

Discussion in 'Javascript' started by pbd22, Mar 18, 2008.

  1. pbd22

    pbd22 Guest

    Hi All.

    I am having problems:

    1) adding an email to a list, creating a long list box of email
    addresses.
    2) sending all the email addresses to the server on form submit.

    The current problem is that:

    1) The input field does not display the added email addresses
    (I am currently getting "options.length" is not an object").
    2) when i submit the form (with test values) the email addresses
    from the list box never appear on the server via Request.Form

    Here is my code for adding an email.

    function AddSomething() {
    var inputvalue = document.getElementById('visitor').value;
    var formObject = document.getElementById('invitepresenters');
    addOption(formObject,inputvalue,inputvalue);
    document.getElementById('visitor').value = "";
    }

    function addOption(selectObject,optionText,optionValue)
    {
    var optionObject = new Option(optionText,optionValue)
    var optionRank = selectObject.options.length
    selectObject.options[optionRank]=optionObject
    }

    And The HTML:

    <input class="input_small" type="text" name="visitor" id="visitor"
    value="<%=Request.Form("visitor")%>" />
    <input type="button" value="Add" style="position: relative; margin-
    top: 6px; display: inline;
    padding-bottom: 3px; padding-top: 3px; line-height: 14px;"
    onclick="AddSomething();" />

    <select class="select_medium" name="visitors" size="7"
    multiple="multiple">
    </select>

    <textarea class="text_xlarge" rows="5" cols="80"
    name="invitepresenters" id="invitepresenters" style="margin-bottom:
    10px" >


    I Would Like the Email To Appear As Such In The Select Box:

    <option value=""></option>

    I appreciate your help.
    Peter
     
    pbd22, Mar 18, 2008
    #1
    1. Advertising

  2. pbd22

    pr Guest

    Re: Can't Add Email To List Box Or Send Email List To Server - Pls.Help

    pbd22 wrote:
    [...]
    >
    > Here is my code for adding an email.
    >
    > function AddSomething() {
    > var inputvalue = document.getElementById('visitor').value;
    > var formObject = document.getElementById('invitepresenters');


    OK. That's the textarea then.

    > addOption(formObject,inputvalue,inputvalue);
    > document.getElementById('visitor').value = "";
    > }
    >
    > function addOption(selectObject,optionText,optionValue)
    > {
    > var optionObject = new Option(optionText,optionValue)
    > var optionRank = selectObject.options.length


    A textarea doesn't have options.

    > selectObject.options[optionRank]=optionObject
    > }
    >
    > And The HTML:
    >

    [...]
    >
    > <textarea class="text_xlarge" rows="5" cols="80"
    > name="invitepresenters" id="invitepresenters" style="margin-bottom:
    > 10px" >


    Answer: use the select element instead. I suggest you name your form
    elements more imaginatively so you can tell them apart. Also read about
    form element access in the FAQ.
     
    pr, Mar 19, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pls send me dotnet faq's

    , Sep 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    948
  2. Gnarlodious
    Replies:
    4
    Views:
    17,641
    elizas
    May 5, 2010
  3. java4suj
    Replies:
    0
    Views:
    487
    java4suj
    Nov 16, 2006
  4. Replies:
    1
    Views:
    1,200
    Andrew Thompson
    Feb 6, 2007
  5. Replies:
    1
    Views:
    128
    Austin Ziegler
    Mar 6, 2007
Loading...

Share This Page