• 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: How to display the result from calculation in text

How to display the result from calculation in text 10 years 4 months ago #25816

Hi Everybody, (and sorry for my english, I'm a french girl :blush: :blush: :kiss:)

I'm new in the forum, and I really like RSFORM Pro (I purchase it). It's a really powerful tool
I have a little question, I don't know how to do that with RSFORM

I would like to create advanced calculation "design", for example :
<input text with value : 50> + <input text with value : 35>
The amount is {total of the two input} dollars => The amount is 85 dollars

Or a picture to understand better :


I am able to put the amount inside of a <input text> with javascript or calculation of rsform,
BUT I don't know how I can put the amount inside of a line of text ! I don't want to have the design of an input text box for the amount.
In my example, if the customer change the numbers in the input text, I would like that the amount inside of my line of text change immediately.

If somebody have a link or something else ? I learn by myself, but I don't know what I need to find :(

Thank you very much to everybody !

Stephanie
The administrator has disabled public write access.

How to display the result from calculation in text 10 years 4 months ago #25821

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

You can try using a FreeText element, to which you can add a span element in the "Text" area:

www.rsjoomla.com/support/documentation/v...e/832-free-text.html

Example:
<span id="myspan">The amount is 0 dolars.</span>

Notice that the span has an ID, this will be used to assign the calculation value for it. Next thing you will need a function that will perform the calculation and assign the total to the span:
<script type="text/JavaScript">
function spanValue(){
	myvar = parseInt(document.getElementById('first-textbox-name').value) + parseInt(document.getElementById('second-textbox-name').value);
 
	document.getElementById('myspan').innerHTML = "The amount is " + myvar + " dolars";
}
</script>

The above script is added by going to backend > Components > RSForm!Pro > Manage Forms > your form > Properties > CSS and JavaScript > JavaScript area.
Final thing would be to use a trigger for the function, on both textboxes:
onkeyup="spanValue();"

This trigger is simply added by editing the textboxes, within the Additional Attributes area(backend > Components > RSForm!Pro > Manage Forms > your form > edit a textbox > Attributes tab).
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.
The following user(s) said Thank You: mst_wesker_hotmail_com, nate.hunter, xxxxxterpxxxxx, makesomeonemeri

How to display the result from calculation in text 10 years 4 months ago #25830

Hi,

OMG Thank you so much it work fine !!! ;)
Now I have a lot of possibilities with advanced text and variable :silly:

I think it will be good to put it to the tutorial

Thank you and have a nice day
Stephanie :kiss:
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!