+1
Z odpowiedzią
How can I add multiple text field inputs together then divide?
I have 4 text fields, that use a number pad keyboard. I want take the average of all of the inputs from the field, then divide by the number of inputs (there are 4). How would I do this? I'm not very familiar with the action tags on Rarewire, by the way.
Customer support service by UserEcho
Your assign tags will serve to capture the contents of the textfield like so:
<action name="capturefieldvalues">
<assign property="var:textfield1" value="[object:TEXTFIELDALIAS1.text]"/>
<assign property="var:textfield2" value="[object:TEXTFIELDALIAS2.text]"/>
<assign property="var:textfield3" value="[object:TEXTFIELDALIAS3.text]"/>
<assign property="var:textfield4" value="[object:TEXTFIELDALIAS4.text]"/>
</action>
Object properties for the text attribute of your textfields can be assigned as above. Once you have variables stored for these fields then you can use an eval to average them out and display in a 5th total textfield. Evals are simply javascript computations and can perform simple math very easily.
<action name="populateaverage">
<assign property="object:TOTALFIELDALIAS.text" value="[eval:([var:textfield1]+[var:textfield2]+[var:textfield3]+[var:textfield4])/4]" />
</action>
https://studio.rarewire.com/wordpress...
This tutorial will introduce you to action triggers or on's. Adding an onclickup or onhover type attribute to your button object allows you to choose the action that is initiated.