I have a VF page set up for users to enter one or more Opportunity Products from a custom search. I also have a script set up to default the Quantity field to "1". The problem I am running into is that if a user changes the Quantity to anything but "1", when a new product is added to the list my VF page ReRenders and the value of the Quantity is then reset back to "1". Does anyone know how I can update my script to populate "1" if the Quantity field is empty and use the value already entered in the Quantity field if it is not empty?
VF Line:
<apex:inputField value="{!s.Quantity}" style="width:70px" required="true" id="qty">
<script>
document.getElementById('{!$Component.qty}').value = 1;
</script>
</apex:inputField>