• 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: Using a button to update a payment field

Using a button to update a payment field 8 years 2 months ago #36534

  • ijwesley
  • ijwesley's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi

I am trying to update a price field when a user enters a specific code and clicks a button.
Ideally, what I would like is for the Discount Value to update to the current form total when the user correctly fills in the Discount Code aand then clicks the Apply Discount button. What I currently have is not working, and any help or alternative suggestions would be greatly appreciated.

Thanks

So far I have the following:
A single line text field "Discount Code" that the user fills in (currently, the code is "secret")
A Button "Apply Discount" with the code onclick="ApplyDiscount();" in the additional attributes
A payment field DiscountValue with a default value of 0.00 (I am using the donation field, but I suppose I could use the single product field)

The following in the Form Javascript section

<script type="text/javascript">
function ApplyDiscount() {
if document.getElementById('DiscountCode').value = "secret" {
document.getElementById('DiscountValue').value = document.getElementById('rsfp_Total').value; }
}
</script>
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!