Published the Calculated Fields Form v1.0.19 (v5.0.20 for the Pro version)

We have received many requests about using the parameters passed to the webpage in the equations, or to populate the form’s fields. We have taken into account the users requests, but we’ve gone a little further. In the new version of the plugin we have implemented a new shortcode to create JavaScript variables not only from parameters received by POST, or GET, also from SESSION variables, or COOKIES.

To use the new shortcode, press the icon with the “X” symbol, in the contents editor.

js_variable

The action inserts a shortcode in the page’s content, with the format:

[CP_CALCULATED_FIELDS_VAR name=”…”]

The … symbol should be replaced by the name of the parameter or variable, and will be the same name of the javascript variable. For example:

[CP_CALCULATED_FIELDS_VAR name=”varname”]

To restrict the source of the variable ( a parameter received by GET or POST, a SESSION variable, or COOKIE), defines the attribute “from” in the shortcode, with any of following values: get, post, session, or cookie. For example, to create the javascript variable: varname, only if exist a session variable with the same name, insert the  shortcode:

[CP_CALCULATED_FIELDS_VAR name=”varname” from=”session”]

After insert the previous shortcode, a valid equation would be: fieldname1*varname, because exists a javascript variable: varname with a global scope.

If you have only one form in your page, and you want assign the value of varname variable to the input field: fieldname1, the corresponding code would be:

<script>
jQuery(function($){
$(document).one(
           'showHideDepEvent', 
           function(){ 
              $('#fieldname1_1 input').val(varname);});
           });
</script>

http://wordpress.dwbooster.com/forms/calculated-fields-form