• 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: results of a calculation on same page?

results of a calculation on same page? 16 years 5 months ago #5619

  • nyree
  • nyree's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
Hi
The simple calculation tutorial uses the submit button to get the results in a new page

onclick=\"document.getElementById('total').value = parseInt(document.getElementById('Field1').value) + parseInt(document.getElementById('Field2').value);\"

How do I change this code to display the results on the
    same
page?

Thanks
Nyree
The administrator has disabled public write access.

Re:results of a calculation on same page? 16 years 5 months ago #5647

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
Hello,

The results are displayed on the same page, that's what the Javascript code is for.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re:results of a calculation on same page? 16 years 5 months ago #5655

  • nyree
  • nyree's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
Hi I followed the tutorial, and it states:

In this tutorial we will describe how to perform some field calculations in RSform!Pro and displaying the result in the \"Thank you !\" message.

so the user can only access the results on a 'new' thankyou page or in an email, I wanted to display the results immediately on the same page...

(I changed the submit button for an ordinary button to stop the page sending action, but there may be better solutions)

any suggestions?

thanks
Nyree
The administrator has disabled public write access.

Re:results of a calculation on same page? 16 years 5 months ago #5662

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
Hello,

Let's say you create two textboxes: one named \"calc1\" and another one \"calc2\". I've chosen textboxes but they could be almost anything else.
A third textbox will be named \"total\". You can set an additional attribute
readonly=\"readonly\"
so it can't be modified by the visitor.

Now, create a button (not a submit button!), name it whatever you want, and paste this additional attribute:
onclick=\"document.getElementById('total').value = parseInt(document.getElementById('field1').value) + parseInt(document.getElementById('field2').value);\"

There you have it! When you click the button, the total textbox will contain the sum of the field1 and field2 textboxes.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
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!