Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > writing from hidden field to text field

Reply
Thread Tools

writing from hidden field to text field

 
 
Roy Adams
Guest
Posts: n/a
 
      12-20-2004
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[i].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?
 
Reply With Quote
 
 
 
 
RobB
Guest
Posts: n/a
 
      12-20-2004
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[i].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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Hidden field on post back and retrieve value from Hidden Field Rick ASP .Net 3 04-13-2010 05:38 PM
Pass hidden form field value to another form field to insert in db GavMc ASP General 4 09-22-2005 06:33 PM
How would I discover the text in a block element hidden by overflow:hidden style being set? SolarCanine Javascript 2 09-20-2005 06:27 PM
maximum characters in hidden text field Mortar HTML 7 01-25-2005 11:33 AM
writing from hidden field to text field repost Roy Adams Javascript 3 12-21-2004 02:32 PM



Advertisments