Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Feb 2003
    Location
    UK
    Posts
    139
    Thanks
    0
    Thanked 1 Time in 1 Post

    javascript form calculations

    I have a form containing 12 drop down lists to enable a user to configure a machine. At the bottom of the page there is an "update price" button which when hit looks at the options selected and then indicates cost of the machine. This all works fine. (I must sya I did not write all the coding for this, but have tweaked the original to suit).

    I wish to accomplish two things:

    1: I want the drop down lists to read a value from somewhere else other than the hard coding inside the form, so that prices can be more easily updated by anyone, without looking at the coding of the page.
    Currently price is pulled for example from (11270 is the price).

    Code:
    else if (form.machine[2].selected){
    	pr_flag =11270;
    pr_print="P/L";
    the dropdown list coded as for example

    Code:
      <P><SELECT name=machine id="machine"> 
                <OPTION 
                    selected>Select<OPTION>P/L</OPTION>

    2: The second thing I would like to do is have just one form that caters for a whole range of machines. The current form is just for one particular machine.
    The idea I had in mind was to add another dropdown list with all the machine types in it, then when one is selected somehow it reads the correct data for prices for that particular machine.

    I am not sure if both of these options can be accomodated in the one form and if they can I dont know where to start, so some help would be appreciated.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Can you post a url to an example page?
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    Regular Coder
    Join Date
    Feb 2003
    Location
    UK
    Posts
    139
    Thanks
    0
    Thanked 1 Time in 1 Post
    Note: this link is not my site but for the purposes of what I am trying to achieve the coding is similar. The calculator I am trying to develop is not for publishing on the internet (internal use only).

    Code:
    http://www.intranetjournal.com/corner/configurator.html

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    One other option would be to use arrays to dynamically populate the selectboxes but this might not be as easy as hard coding in the page.

    Take a look at this example which populates just 3 selectboxes and then imagine the arrays needed for 12 selectboxes, not for the faint hearted

    http://www.huntingground.freeserve.c..._opts_pop2.htm
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    Regular Coder
    Join Date
    Feb 2003
    Location
    UK
    Posts
    139
    Thanks
    0
    Thanked 1 Time in 1 Post
    I see what you mean, it would turn into a marathon, maybe I'll stick to the hard coding.

    thanks


  •  

    Posting Permissions

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