Interactive Combo Box(es)

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Interactive Combo Box(es)

    Hello:

    I've been trying to get a text field to react to the changes in a combo box
    selection with JavaScript, with no luck. I'm wondering if it is possible to do
    this with some built in behaviours in Dreamweaver?

    Basically, if you select the size of something "5 X 7" in the "Size" list box,
    I would like the Price to reflect that the customer has chosen a photograph and
    display the price amount ($8). I've tried putting in numerous 'if' statement
    to a function and then calling the function on the OnClick command, but it
    isn't updating the Price textfield at all in this way. I've added the onClick
    behaviour to the list box by attaching the javascript and this doesn't do
    anything, either. All combos are in the same form, although on different
    fieldsets (would this make a difference in the document.orderForm... statement?)

    Thanks, in advance for any help.

    Kim Connerty

    kconnerty Guest

  2. Similar Questions and Discussions

    1. Help Please! Interactive map
      I have to create an interactive map, which shows the campus layout of a university. I want the user to be able to rollover, or click on any...
    2. Interactive Map
      Hi!What I'd like to do is this I have an animation size ca. 500x400 dpi. In this animation I have a map of one part of a city that is cut into...
    3. interactive tv
      Does anyone know where i can find some information on how to develope an interactive tv enviroment (preferably a tutorial). the specific type of...
    4. Interactive pdf?
      Using an Excel spreadsheet, a program has been created to determine the high and low cost of an item. Is there a way to turn this spreadsheet into a...
    5. interactive map?
      Please help, I'm trying to build an interactive map where a series of buttons to the side of the map add elements (roads, attractions, etc') onto...
  3. #2

    Default Re: Interactive Combo Box(es)

    use the onChange handler in the list box SELECT tag :

    <HEAD>
    <SCRIPT>
    pricesArray = (8.00, 5.50, ...);

    function changePrice(id) {
    document.orderForm.Price.value = pricesArray(id);
    }
    </SCRIPT>
    </HEAD>

    <BODY>
    ....

    <SELECT name="Size" ... onChange="changePrice(this.selectedIndex)">
    ....

    <INPUT type"text" name="Price">
    ....


    the pricesArray can be static (declare in the HTML page) or created
    dinamically at server-side retrieving data from a DB

    HTH,

    manuel


    kconnerty wrote:
    > Hello:
    >
    > I've been trying to get a text field to react to the changes in a combo box
    > selection with JavaScript, with no luck. I'm wondering if it is possible to do
    > this with some built in behaviours in Dreamweaver?
    >
    > Basically, if you select the size of something "5 X 7" in the "Size" list box,
    > I would like the Price to reflect that the customer has chosen a photograph and
    > display the price amount ($8). I've tried putting in numerous 'if' statement
    > to a function and then calling the function on the OnClick command, but it
    > isn't updating the Price textfield at all in this way. I've added the onClick
    > behaviour to the list box by attaching the javascript and this doesn't do
    > anything, either. All combos are in the same form, although on different
    > fieldsets (would this make a difference in the document.orderForm... statement?)
    >
    > Thanks, in advance for any help.
    >
    > Kim Connerty
    >
    Manuel Socarras Guest

  4. #3

    Default Re: Interactive Combo Box(es)

    Thank you, Manuel. Appreciate the help.

    I've put the code in and I understand how it's supposed to work - much better
    than the "if" statements I was using. However, I continually get an error at
    the browser: Error: function expected, when I select something from the
    photoSize listbox.

    The only change I made from what you posted was to replace 'price' with
    'photoPrice', which is the name of the textfield. Here's the code snippet:

    <!--
    pricesArray = (6, 8, 12, 24, 36);

    function changePrice(id) {
    document.orderForm.photoPrice.value=pricesArray(id );
    }
    -->

    The onChange calls the function for photoSize. I'm not totally versed in js
    (as you can probably tell). Any additional help you propose will be greatly
    appreciated.

    Thanks,

    Kim

    kconnerty Guest

  5. #4

    Default Re: Interactive Combo Box(es)

    sorry, was my fault; too much VBScript lately! change the parentheses
    for brackets when referring to the array:

    document.orderForm.photoPrice.value=pricesArray[id];


    manuel

    kconnerty wrote:
    > Thank you, Manuel. Appreciate the help.
    >
    > I've put the code in and I understand how it's supposed to work - much better
    > than the "if" statements I was using. However, I continually get an error at
    > the browser: Error: function expected, when I select something from the
    > photoSize listbox.
    >
    > The only change I made from what you posted was to replace 'price' with
    > 'photoPrice', which is the name of the textfield. Here's the code snippet:
    >
    > <!--
    > pricesArray = (6, 8, 12, 24, 36);
    >
    > function changePrice(id) {
    > document.orderForm.photoPrice.value=pricesArray(id );
    > }
    > -->
    >
    > The onChange calls the function for photoSize. I'm not totally versed in js
    > (as you can probably tell). Any additional help you propose will be greatly
    > appreciated.
    >
    > Thanks,
    >
    > Kim
    >
    Manuel Socarras Guest

  6. #5

    Default Re: Interactive Combo Box(es)

    JavaScript is case sensitive. Make sure your lowercase and capital letters
    match for everything - form name, field name, function name, etc.

    "kconnerty" <webforumsuser@macromedia.com> wrote in message
    news:cv2hum$h8o$1@forums.macromedia.com...
    > Thank you, Manuel. Appreciate the help.
    >
    > I've put the code in and I understand how it's supposed to work - much
    better
    > than the "if" statements I was using. However, I continually get an error
    at
    > the browser: Error: function expected, when I select something from the
    > photoSize listbox.
    >
    > The only change I made from what you posted was to replace 'price' with
    > 'photoPrice', which is the name of the textfield. Here's the code
    snippet:
    >
    > <!--
    > pricesArray = (6, 8, 12, 24, 36);
    >
    > function changePrice(id) {
    > document.orderForm.photoPrice.value=pricesArray(id );
    > }
    > -->
    >
    > The onChange calls the function for photoSize. I'm not totally versed in
    js
    > (as you can probably tell). Any additional help you propose will be
    greatly
    > appreciated.
    >
    > Thanks,
    >
    > Kim
    >

    CMBergin Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139