Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

HTML JAVA Help

  • 09-10-2004 10:50am
    #1
    Closed Accounts Posts: 4


    Hi,

    Looking for a bit of basic help here....

    I am modify a webpage and have setup an order form which will send the info to an email.. I am using the following format.....

    form1.BODY.value += 'Email = ' + form1.email.value;

    However, I'm trying to get the form to report bacak a selection from a drop down menu.....

    For example Gender (pick Male or Female...)

    How can I do this ?

    Thanks,

    Dazza


Comments

  • Registered Users, Registered Users 2 Posts: 21,084 ✭✭✭✭Stark


    Don't think you need javascript for that, just basic HTML form tags.

    The following code should do it:

    [HTML]
    <select name="gender">
    <option value="male">
    <option value="female">
    </select>
    [/HTML]


  • Closed Accounts Posts: 4 dazza2003


    Stark,

    I have used this script already in setting up the form and it works fine....

    Now I'm trying to have it so that when "SUBMIT" is hit it will send me an email with the order details....

    I'm using this ....

    form1.BODY.value += 'Child Age = ' + form1.ChildAge.value;
    form1.BODY.value += 'Gender = ' + form1.gender.value;
    form1.BODY.value += 'Home = ' + form1.home.value;

    And it work fine when the entry is simply keyed in..... however, when you select gender for example, it returns nothing.... any thoughts ?

    Thanks,

    Dazza


  • Closed Accounts Posts: 304 ✭✭Zaltais


    dazza2003 wrote:
    form1.BODY.value += 'Gender = ' + form1.gender.value;


    Try:
    form1.BODY.value += 'Gender = ' + form1.gender[form1.gender.selectedIndex].value;
    


  • Closed Accounts Posts: 4 dazza2003


    Afraid that didn't work !!

    Any other suggetsions ???

    Thanks again for your help....

    Dazza


  • Closed Accounts Posts: 304 ✭✭Zaltais


    Hmmm, worked in my test here ok...

    Can you post a link to the page, or the full code? Kinda hard to see exactly what's going wrong without a complete frame of reference.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,523 ✭✭✭optiplexgx270


    what zaltais posted IS the solution....

    But your best bet is to post the section of code not working or the URL to the page as stated.


  • Closed Accounts Posts: 4 dazza2003


    Guys,

    Here is the relevant section page.....


    <div id="Layer3" style="position:absolute; left:230px; top:169px;

    width:555px; height:671px; z-index:5">
    <table width="100%" height="637" border="0">
    <tr>
    <td height="56"><strong><font color="#000000" size="+2" face="

    Arial, Helvetica, sans-serif">Product
    Order Form</font></strong></td>
    </tr>
    <tr>
    <td><form name="form1" method="GET" action="mailto:sales@mykids

    -story.com" onsubmit="ProcessForm()">
    <INPUT TYPE="HIDDEN" NAME="SUBJECT" VALUE="New order">
    <INPUT TYPE="HIDDEN" NAME="BODY" VALUE="BODY" id="BODY">
    <table width="100%" height="586" border="0">
    <tr>
    <td height="29" colspan="2"> <div align="left"><font

    face="Arial, Helvetica, sans-serif"><strong>Delivery
    Details: </strong></font></div></td>
    </tr>
    <tr>
    <td><div align="left"><font face="Arial, Helvetica,

    sans-serif">Name:</font></div></td>
    <td width="406"><input name="name" type="text" id="name"

    size="50"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Address:</font></div></td>
    <td><input name="address" type="text" id="address" size

    ="50"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">City:</font></div></td>
    <td><input name="city" type="text" id="city" size="50"

    ></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">State/
    County:</font></div></td>
    <td><input name="state" type="text" id="state" size="50

    "></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Post/
    Zip Code:</font></div></td>
    <td><input name="zip" type="text" id="zip" size="30"></

    td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Telephone:</font></div></td>
    <td><input name="tel" type="text" id="tel" size="30"></

    td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">email:</font></div></td>
    <td><input name="email" type="text" id="email" size="30

    "></td>
    </tr>
    <tr>
    <td height="36" colspan="2"> <div align="left"><font

    face="Arial, Helvetica, sans-serif"><strong>Personalisation
    Details: </strong></font></div></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Which
    Story?:</font></div></td>
    <td><select name="story" id="story">
    <option selected>The Fairy</option>
    <option>A Day at the Farm</option>
    <option>Too Many Monsters</option>
    <option>The Red Planet</option>
    <option>My Train Adventure</option>
    <option>The Giant Turnip</option>
    </select></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Child's
    Name:</font></div></td>
    <td><input name="ChildName" type="text" id="ChildName"

    size="50"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Child's
    Age:</font></div></td>
    <td><input name="ChildAge" type="text" id="ChildAge"

    size="4"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Gender:</font></div></td>
    <td><select name="gender" id="gender">
    <option selected>Boy</option>
    <option>Girl</option>
    </select></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Home
    Town:</font></div></td>
    <td><input name="home" type="text" id="home" size="50"

    ></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Adult
    in the Story:</font></div></td>
    <td><select name="select">
    <option selected>Mum</option>
    <option>Dad</option>
    <option>Other</option>
    </select> <font face="Arial, Helvetica, sans-serif"

    >Other:</font>
    <input name="other" type="text" id="other" size="32"

    ></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Friend
    One:</font></div></td>
    <td><input name="friend1" type="text" id="friend1" size

    ="30"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Friend
    Two:</font></div></td>
    <td><input name="Friend2" type="text" id="Friend2" size

    ="30"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Dedication
    Line 1:</font></div></td>
    <td><input name="dedication1" type="text" id="

    dedication1" size="50"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Dedication
    Line 1:</font></div></td>
    <td><input name="dedication2" type="text" id="

    dedication2" size="50"></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif">Giver's
    Name:</font></div></td>
    <td><input name="giver" type="text" id="giver" size="50

    "></td>
    </tr>
    <tr>
    <td width="133"> <div align="left"><font face="Arial,

    Helvetica, sans-serif"></font></div></td>
    <td><input type="submit" name="Submit" value="Submit

    Order"> <input name="reset" type="reset" id="reset" value="Clear Form

    "></td>
    </tr>
    </table>
    </form></td>
    </tr>
    </table>
    <font face="Arial, Helvetica, sans-serif"><strong>Please Note</

    strong>: A member
    of the Read My Story team will make contact with you normaly within

    24hrs of
    placing your order to confirm details and arrange payment.</font></

    div>
    <table width="800" height="948" border="0" background="Graphics/

    background_long.jpg">
    <tr>
    <td width="902" height="944"> </td>
    </tr>
    </table>
    <script language="javascript">
    function ProcessForm()
    {
    form1.BODY.value = 'Name = ' + form1.name.value + '\n';
    form1.BODY.value += 'Address = ' + form1.address.value;
    form1.BODY.value += 'City = ' + form1.city.value;
    form1.BODY.value += 'State = ' + form1.state.value;
    form1.BODY.value += 'Zip = ' + form1.zip.value;
    form1.BODY.value += 'Phone = ' + form1.tel.value;
    form1.BODY.value += 'Email = ' + form1.email.value;
    form1.BODY.value += 'story = ' + form1.story.option;
    form1.BODY.value += 'Child Name = ' + form1.ChildName.value;
    form1.BODY.value += 'Child Age = ' + form1.ChildAge.value;
    form1.BODY.value += 'Gender = ' + form1.gender[form1.gender.

    selectedIndex].value;
    form1.BODY.value += 'Home = ' + form1.home.value;
    form1.BODY.value += 'Story = ' + form1.select[form1.story.

    selectedIndex].value;
    form1.BODY.value += 'Adult = ' + form1.select[form1.adult.

    selectedIndex]value;
    form1.BODY.value += 'Other = ' + form1.other.value;
    form1.BODY.value += 'Friend1 = ' + form1.friend1.value;
    form1.BODY.value += 'Friend2 = ' + form1.Friend2.value;
    form1.BODY.value += 'Dedication1 = ' + form1.dedication1.value;
    form1.BODY.value += 'Dedication2 = ' + form1.dedciation2.value;
    form1.BODY.value += 'Giver = ' + form1.giver.value;

    }
    </script>
    </body>
    </html>

    Thanks,

    Darren


  • Closed Accounts Posts: 304 ✭✭Zaltais


    Ok these two lines:
    dazza2003 wrote:
    form1.BODY.value += 'Story = ' + form1.select[form1.story.selectedIndex].value;
    form1.BODY.value += 'Adult = ' + form1.select[form1.adult.selectedIndex]value;

    should be
    form1.BODY.value += 'Story = ' + form1.story[form1.story.selectedIndex].value;
    form1.BODY.value += 'Adult = ' + form1.adult[form1.adult.selectedIndex].value;
    

    Also this only works when the value in the select field has been selected - so you will want to put in 'Pick One' as the first option in each of your select boxes, so that the user can't just leave the values at their defaults, and has to explicitly pick one.

    Other than than that it works here for me.


Advertisement