• 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: simple area calculator

simple area calculator 14 years 1 week ago #10468

Is it possible to create a simple 'area calculation' using two drop down boxes?
<p>Width of area
  <select >
    <option selected>select</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
  </select>
</p>
<p> Length of area
  <select >
    <option selected>select</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
  </select>
</p>
<p>
  <input type="text" value="result">
</p>



If the user selects a variable from each drop down it creates the calculation result?

if this is possible I would like to add a few more fields to the calculation, but probably easier if we go through it step by step.
The administrator has disabled public write access.

Re:simple area calculator 14 years 1 week ago #10470

  • andreic
  • andreic's Avatar
  • NOW ONLINE
  • RSJoomla! Official Staff
  • Posts: 733
  • Thank you received: 60
Hello,

You can try adding a javascript in your "Form Layout" tab that performs the desired calculation. For example the following script will add up two values from different dropdown lists:
<script type="text/javascript">
function total(){
     document.getElementById('result').value = parseInt(document.getElementById('width').value) + parseInt(document.getElementById('length').value);
}
</script>

This function should be triggered when the users selects a value from the dropdown by adding this line in the "Additional attributes" of the dropdown field:
onchange="total();"
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
Last Edit: 14 years 1 week ago by andreic.
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!