Hide calculations

zebrafilm

Member
In my form I have the input in one group and the calculations in another group on the same page.
But the calculations should only be visible to managers, not to registered or lower.

If I set the group to show for managers and higher, nothing gets calculated for registered users. Clearly hiding by user level means switch off completely.
If I hide the group they keep working.

What could be a smart option to keep the calculations visible for higher levels, hide them for lower levels but still let them do the calc job.
 
Yes the element would be disabled, or switched off as you put it, if they do not have permission for it. The group or element itself can be hidden but with the correct knowledge using firebug or viewing the source registered users would be able to see the calculation.

I'm assuming you want the calculation stored regardless of who is logged in but only visible to managers and higher.

Off the top of my head would be to use a form PHP plugin to run some code OnBeforeStore. You can duplicate your calculation in a PHP form plugin changing some of the parameters where necessary.

http://fabrikar.com/forums/index.php?wiki/php-form-plugin/

Someone else may have a better suggestion.
 
They are all ajax controlled calculations. Would that work with an external form? Using that plugin would probably run only after moving clicking the final 'save'.
Now I have a multipage form. Every page has input and results/calcs and they need to be checked before moving on.

I guess in the final version I could live with a OnBeforeStore so I will check if it is possible. Might speed up my pages too but for now it seems not the best solution. Thanks for the feedback!
 
Well it's not exactly an external form, it's a plugin for the existing form. When you submit the plugin will have all the values it needs to perform the calculation as they are based on element data being stored.

Now I have a multipage form. Every page has input and results/calcs and they need to be checked before moving on.

I didn't realise this which of course makes it a different scenario.

The only other way I can think of doing this then is via AJAX without using the Calc element, (i.e via the userAjax file), so you have more control what is happening. This allows the calculations to be run to trigger whatever the next step of the form is. I would imagine you would have to store the results as session data so it can be picked up later to store into the database.

I've never actually done this though so there maybe a better solution. Let's see what Queen Troester says. :)
 
What exactly do you mean by "visible"?

Do you mean that they simply shouldn't be visible to a "casual observer", so they don't show on the visible web page, but the calculation results can be stored in some non-visible form input, which could be seen by anyone with Firebug and a little bit of knowledge?

Or do you mean that the calculation results are "secret", and must not be visible under any circumstance to anyone but the managers?

-- hugh
 
The calculations create the prices according to what is filled in by the customer. We want the customer to only see the end quote.
But a manager might need to see how it is done, adjust a setting and read some articles codes.
I have made all calculations in a subgroep (Called berekeningen xxxx) which I can 'hide' from view in group settings and everything will still be calculated.
This does not leave an option to only hide for certain user levels it seems.

I don't expect truckers to be expert hackers but still I need to make sure prices are not out in the open for the competition. So yes it needs to be 'a bit' safe.
Below an example of one of the page without the hiding.

Screen Shot 2014-08-21 at 12.17.30.png
 
So I think

Or do you mean that the calculation results are "secret", and must not be visible under any circumstance to anyone but the managers?

applies then.

Usually when we are hiding things it is hiding it from view but it is accessible with a little know how.

So as per my first suggestion you can have all the calculations run as the form submits via a plugin. This is done on the backend and the data is not seen anywhere.

However if the calculations are dependent on different stages of the form this is not suitable. so as per the second suggestion, I think the only viable route would be to use some AJAX routines which would effectively run the calculations in the background and produce the price \ result without showing how the calculation was made.

This would mean changing all your calc elements to run via UserAjax otherwise you would be maintaining two sets of code which is prone for errors.

As long as you have a stored value somewhere in which the AJAX calculations can be run it will work. The AJAX is not dependent on the permission of the user so will be able to access everything. So for instance, if the registered user is entering quantities for a product and there is a calculation that applies a discount or how much that user pays for the product, it will work as long as those values are stored somewhere.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top