Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    6
    Member #
    21885
    Hi all. I hope someone can help.
    I am creating a simple form and was hoping to stay using HTML although I doubt it. Basically I am streaming the data of the form once I submit it to a secure sever and a response is sent off to another page. I have tested the form and it uses a JS query and it works fine. Now I am hoping to add some user friendly features to it starting with this little problem.
    The thing I am trying to do is to select an option from a drop down box i.e. name=Product and then a secound text input field (or just a returned value is automatically filled in with a value name=Price. Obviously I need both values to be included in the data when the form is submitted.
    I have cut down my form as a simple example below:

    <FORM METHOD=POST ACTION="https://www.my-secure-domain.com">
    <P>Product: <SELECT Name="ref">
    <option value="item 1">Item 1</option>
    <option value="item 2">Item 2</option>
    <option value="item 3">Item 3</option>
    <option value="item 4">Item 4</option>
    </Select></p>
    <P>Product Price: <INPUT TYPE="This is where I am having trouble"></p>
    <P>Submit: <INPUT TYPE="submit" NAME="submitbutton" VALUE="Submit" ACTION="SEND"> </p>
    </FORM>
    What I want to happen is say when I select "item 1" in the first field then "$5.00" will display in the second field.
    I am assuming I will have to move away from using HTML.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    I this all based off of a database, like MySQL, or are you "hardcoding" it on an HTML page?


  4. #3
    Junior Member
    Join Date
    May 2010
    Posts
    6
    Member #
    21885
    No this is just coding from a HTML page. I left out all the other tags to make things simple

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    What I'm getting at is,
    Will the items and cost always be the same on that page, or are the items
    and prices being accessed from a database?

    This makes a difference, because you could just use some Javascripting to "hard-code"
    the items and prices as they select the items. Then, you have the part about selecting
    items and Javascript keeps a total (like a shopping cart). But you didn't mention them
    selecting more than one item?

    But if the items and prices are coming from a database, you would not be able to
    "hard-code" into Javascripting ... it would be more of an AJAX type of scripting.

    What your form does, and how the page is generated will change our answer.


  6. #5
    Junior Member
    Join Date
    May 2010
    Posts
    6
    Member #
    21885
    Thanks Miseim.
    I already have a shopping cart elsewhere on my website for all of my products. This form is for a barter service which I recently became a member were I am offering only say 6-8 products. Therefore I am wanting to just hardcode these products onto the page and keep things simple. Thanks

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    See this code run ...
    http://js-x.com/page/javascripts__example.html?run=141

    click on "Apple" and select "Peach".
    it changes the price in the box.

    Click on the "get the code now" link to see the code.


    .


  8. #7
    Junior Member
    Join Date
    May 2010
    Posts
    6
    Member #
    21885
    That is exactly what I was looking for. Nothing like a good example. It works like a charm. Thanks a heap.:thumbsup:

  9. #8
    Junior Member
    Join Date
    May 2010
    Posts
    1
    Member #
    21917
    When you write a form , always try to put from name like this.

    <form name="form1" action="<SITE NAME>" method="post">

    thanks

  10. #9
    Senior Member
    Join Date
    Dec 2008
    Posts
    483
    Member #
    17875
    Liked
    1 times
    2D arrays is perfect for what your doing, and thats how you should be doing it

    http://www.trans4mind.com/personal_d...pt/Array2D.htm


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:45 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com