writing from hidden field to text field

Discussion in 'Javascript' started by Roy Adams, Dec 20, 2004.

  1. Roy Adams

    Roy Adams Guest

    Hi Group
    I'm trying to write from dynamically created hidden fields to a txt
    field in the onchange event handler within a select.

    basically the number for the for loop is generated by a field from a
    db
    which creates hidden fields populated by prices
    once the onchange handler fires it sets the text for the text field
    price and the hidden field Tsize, but I can't get it to set the txt of
    oldprice from the hidden field prevprice.

    here's the code
    <SCRIPT LANGUAGE=JavaScript>
    <!--
    function ch_price (theForm) {
    for (i=0; i < <%=(rsSaleC.Fields.Item('prodC').Value)%>; i++){

    document.form1.price.value =
    document.form1.size.options[document.form1.size.selectedIndex].value;

    document.form1.Tsize.value =
    document.form1.size.options[document.form1.size.selectedIndex].text;

    document.form1.oldprice.value = document.form1.prevprice.value;
    }
    }
    //-->

    </SCRIPT>
    and in the body


    <select name="size" id="size" onChange="ch_price(form1)">
    <option selected
    value="<%=(rsDisplay.Fields.Item("Price").Value)%> ">Select
    Size/Colour</option>

    <%
    while (!rsSale.EOF) {
    %>
    <option
    value="<%=(rsSale.Fields.Item("price").Value)%>"
    ><%=(rsSize.Fields.Item("Size").Value)%></option>



    <%
    rsSale.MoveNext();
    }
    if (rsSale.CursorType > 0) {
    if (!rsSale.BOF) rsSale.MoveFirst();
    } else {
    rsSale.Requery();
    }
    %>

    does any one have any ideas?
     
    Roy Adams, Dec 20, 2004
    #1
    1. Advertising

  2. Roy Adams

    RobB Guest

    Roy Adams wrote:
    > Hi Group
    > I'm trying to write from dynamically created hidden fields to a txt
    > field in the onchange event handler within a select.
    >
    > basically the number for the for loop is generated by a field from a
    > db
    > which creates hidden fields populated by prices
    > once the onchange handler fires it sets the text for the text field
    > price and the hidden field Tsize, but I can't get it to set the txt

    of
    > oldprice from the hidden field prevprice.
    >
    > here's the code
    > <SCRIPT LANGUAGE=JavaScript>
    > <!--
    > function ch_price (theForm) {
    > for (i=0; i < <%=(rsSaleC.Fields.Item('prodC').Value)%>; i++){
    >
    > document.form1.price.value =
    > document.form1.size.options[document.form1.size.selectedIndex].value;
    >
    > document.form1.Tsize.value =
    > document.form1.size.options[document.form1.size.selectedIndex].text;
    >
    > document.form1.oldprice.value = document.form1.prevprice.value;
    > }
    > }
    > //-->
    >
    > </SCRIPT>
    > and in the body
    >
    >
    > <select name="size" id="size" onChange="ch_price(form1)">
    > <option selected
    > value="<%=(rsDisplay.Fields.Item("Price").Value)%> ">Select
    > Size/Colour</option>
    >
    > <%
    > while (!rsSale.EOF) {
    > %>
    > <option
    > value="<%=(rsSale.Fields.Item("price").Value)%>"
    > ><%=(rsSize.Fields.Item("Size").Value)%></option>

    >
    >
    > <%
    > rsSale.MoveNext();
    > }
    > if (rsSale.CursorType > 0) {
    > if (!rsSale.BOF) rsSale.MoveFirst();
    > } else {
    > rsSale.Requery();
    > }
    > %>
    >
    > does any one have any ideas?


    It's always easier to diagnose client-side problems when you can see
    what the client sees. Do you have a sample of the relevant portions of
    a served (no asp) page that you could post?
     
    RobB, Dec 20, 2004
    #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. Mortar
    Replies:
    7
    Views:
    9,133
  2. Rick
    Replies:
    3
    Views:
    8,220
    Alexey Smirnov
    Apr 13, 2010
  3. GavMc
    Replies:
    4
    Views:
    350
    Evertjan.
    Sep 22, 2005
  4. Roy Adams
    Replies:
    3
    Views:
    272
    Dr John Stockton
    Dec 21, 2004
  5. SolarCanine
    Replies:
    2
    Views:
    295
    SolarCanine
    Sep 20, 2005
Loading...

Share This Page