CalcBuilder Forum

Hide fields on Calculate

User _MSTeam# 2012-08-01 18:55:52

Hello,

I have one question, hopefully you have faced this before. Is it at all possible, for when the user clicks the calculate button, the form layout hides as the exit layout shows, and when the reset button is clicked, the form layout is displayed again?

kind Regards,

User _MSTeam# 2012-08-01 18:59:33

Hello,

You can doit adding this code to 'Javascript events' in your Calcbuilder admin:

//DO NOT MODIFY THIS LINE, IS NEEDED TO HANDLE PROPER CALCULATOR INSTANCE
seed=$('cb_layout_wrapper').getParent().getProperty('id').substr(0,$('cb_layout_wrapper').getParent().getProperty('id').indexOf("_"));

// Event on Calculate Button
$(seed+'_calculate').addEvent('click',function(){
// Hide fields
$(seed+'_cb_form').getElement('.cb_layout_wrapper').hide();
// Hide calculate button
$(seed+'_calculate').hide();
});

// Event on Reset Button
$(seed+'_calc_adminForm').getElement('input').addEvent('click',function(){
// Show fields
$(seed+'_cb_form').getElement('.cb_layout_wrapper').show();
// Show Calculate button
$(seed+'_calculate').show();
// Hide results
$(seed+'_cb_result').hide();
});



This code is made with Calcbuilder 2.0.2 and Joomla 2.5.6. This code is commented to help you to get only features you needed.

Hope this helps. Regards,

Moonsoft Team

Moonsoft support 2012-08-02 02:14:39

Thanks, that works perfectly.

...
CalcBuilder

Create dynamic calculators

Buy now!
...
List Manager

Build different lists for your site

Buy now!