Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Alter the value of one field when the value of another field changes.

$
0
0

I have a standard order form that has a number of fields where the quantity (number )is typed in  They are labelled qty1, qty2  and so on.

 

Some of the items on the order form attract an additional fixed one off charge which is shown in a separate field call it addcharge.

 

If qty1  has a number entered it attracts an added charge and the addcharge field alters value from nil to say 1

If qty2  has a numbered entered no additional charge applies

If qty3  has a numbered entered no additional charge applies

If qty4  has a number entered it attracts an added charge and the addcharge field alters value from nil to say 1 or if the previous qty1 has already altered the addcharge field to 1 it stays at 1.

If qty5  has a number entered it attracts an added charge and the addcharge field alters value from nil to say 1 or if the previous qty1 and qty4 has already altered the addcharge field to 1 it stays at 1


It seems to me that some "if else" activation javascript is needed  along the lines of "if field qty1 is greater than 0 the field addcharge is 1" and I assume the script should be placed in every qty field that attracts addcharge.


Can any one help with the script please.


Thanks Eric


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>