M
Matthew Speed
(JS skill level: slightly above newbie)
I have a web page that displays a list of line items. For
simplicity's sake each like looks like
Product 1234 <Product1234Price><input type=hidden
name="product1234price" value="12.95"><input
type="product1234qty"><input type=text name="product1234ext">
where 1234 is the product number from the database. I've written a
script that runs onBlur from the qty field that multiplies the qty
times the price and displays the result in the ext value field. My
problem is that the 1234 changes depending on what items the user has
selected. As a result, I need to set it up so that the javascript
reads something from the current field so that it knows which price to
read and which extended value field to display the total in. My app
works completely from a database standpoint the way this is set up so
I strongly prefer not to change this part but make the script fit the
way I've implemented this.
My initial guess here is that since the name of the qty field is
always known to be product+itemnumber+qty that when I pass it using
the "this" value inside extendprice(this) the called function can
extract it. I am just not too sure how to do this. Can someone help
me out with what I am trying to accomplish?
TIA
I have a web page that displays a list of line items. For
simplicity's sake each like looks like
Product 1234 <Product1234Price><input type=hidden
name="product1234price" value="12.95"><input
type="product1234qty"><input type=text name="product1234ext">
where 1234 is the product number from the database. I've written a
script that runs onBlur from the qty field that multiplies the qty
times the price and displays the result in the ext value field. My
problem is that the 1234 changes depending on what items the user has
selected. As a result, I need to set it up so that the javascript
reads something from the current field so that it knows which price to
read and which extended value field to display the total in. My app
works completely from a database standpoint the way this is set up so
I strongly prefer not to change this part but make the script fit the
way I've implemented this.
My initial guess here is that since the name of the qty field is
always known to be product+itemnumber+qty that when I pass it using
the "this" value inside extendprice(this) the called function can
extract it. I am just not too sure how to do this. Can someone help
me out with what I am trying to accomplish?
TIA