• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Clear Textbox

Clear Textbox 4 years 9 months ago #39334

  • david60
  • david60's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hi Guys,

I am trying to clear a textbox during an event using JS.

My code works as expected apart from Text box values being cleared.

Here is my code.
<script type="text/javascript">
function totalQuantity(){
getPrice_3();
var cn= document.getElementById("codename").value;
quantity = parseInt(document.getElementById("quantity").value);
currentTotal = parseFloat(document.getElementById("total").value);
 total = quantity * currentTotal;
 
switch(cn) {
     case "medicoretest26":
       total = 0;
        break;
  case "None":
      total = quantity * currentTotal;
        break;
    default:
         total = quantity * currentTotal;
 
}
document.getElementById("s1").value="None";
document.getElementById("s2").value="None";
document.getElementById("s3").value ="None";
document.getElementById("s4").value="None";
document.getElementById("s5").value ="None";
document.getElementById("s6").value ="None";
 
  document.getElementById('total').value = total.toFixed(2);
 
  document.getElementById('payment_total_3').innerHTML = total.toFixed(2) + ' EUR';
 
  document.getElementsByName('form[rsfp_Total]')[0].value = total.toFixed(2);
 
 
  switch (quantity) {
                case 1:
                    document.getElementById("s2").style.display = "none";
                    document.getElementById("s3").style.display = "none";
                    document.getElementById("s4").style.display = "none";
                    document.getElementById("s5").style.display = "none";
                    document.getElementById("s6").style.display = "none";
 
                    break;
                case 2:
 
                    document.getElementById("s2").style.display = "block";
                    document.getElementById("s3").style.display = "none";
                    document.getElementById("s4").style.display = "none";
                    document.getElementById("s5").style.display = "none";
                    document.getElementById("s6").style.display = "none";
 
                    break;
                case 3:
                    document.getElementById("s2").style.display = "block";
                    document.getElementById("s3").style.display = "block";
                    document.getElementById("s4").style.display = "none";
                    document.getElementById("s5").style.display = "none";
                    document.getElementById("s6").style.display = "none";
 
                    break;
                case 4:
                    document.getElementById("s2").style.display = "block";
                    document.getElementById("s3").style.display = "block";
                    document.getElementById("s4").style.display = "block";
                    document.getElementById("s5").style.display = "none";
                    document.getElementById("s6").style.display = "none";
 
                    break;
                case 5:
                    document.getElementById("s2").style.display = "block";
                    document.getElementById("s3").style.display = "block";
                    document.getElementById("s4").style.display = "block";
                    document.getElementById("s5").style.display = "block";
                    document.getElementById("s6").style.display = "none";
 
                    break;
                case 6:
                    document.getElementById("s2").style.display = "block";
                    document.getElementById("s3").style.display = "block";
                    document.getElementById("s4").style.display = "block";
                    document.getElementById("s5").style.display = "block";
                    document.getElementById("s6").style.display = "block";
 
                }
 
 
 
return true;
}
 
window.onload = function() {
  totalQuantity();
};
 
window.addEvent('domready', function() {
totalQuantity();
    });
</script>

Textbox s1,s2,s3,s4 etc always hold their value when the event is fired. Any ideas?
Last Edit: 4 years 9 months ago by david60.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!