Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Yii framework extension to support jquery jq-calculator plugin.
JavaScript PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
js
EJqCalculator.php
README.mkd

README.mkd

EJqCalculator

Extensions for the yii framework to support jquery jq-calculator plugin.

Jquery plugin

  • JQ-Calculator formula track.
  • 2011 Andreas Geissel.

"Sometimes the fields of a form are part of a chain of a calculation. For example, when the price of an order position changes, its price including tax should be recalculated. Then the total price (including other additional costs) should also be updated. This means each input element (text, select box, ...) needs an onChange (or onBlur) function that recalculates the new results and triggers other (dependent) fields to update themselves."

Use

Add this to your view:

<table>
    <tr>
        <td>
            <input type="text" name='l[0]'/>
        </td>
        <td>
            <input type="text" name='r[0]'/>
        </td>
        <td>
            <input type="text" id='sum0' />
        </td>
    </tr>
    <tr>
        <td>
            <input type="text" name='l[1]'/>
        </td>
        <td>
            <input type="text" name='r[1]' />
        </td>
        <td>
            <input type="text" id='sum1' />
        </td>
    </tr>
    <tr>
        <th colspan='2'>
      Total Sum
        </th>
        <td>
            <input type="text" id='total'/>
        </td>
    </tr>
</table>

<?php $this->widget('application.extensions.EJqCalculator.EJqCalculator', array(
   'addFormula'=>array(
       '#sum0'=>'{{l[0]}} * {{r[0]}}',
        '#sum1'=>'{{l[1]}} * {{r[1]}}',
       '#total'=>'{{#sum0}} + {{#sum1}}'
   ),
));?>

Resources

Changelog

Version 0.1.1

  • Documentation added.
  • Change of the properties passed to widget structure. ####Version 0.1
  • Initial release.
Something went wrong with that request. Please try again.