Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Conditional Fields (Show/Hide). How to insert additional field-variables? 08.09.2014 18:45

Hello. I am sure there was a message about this, but I cannot find it.

I have the following javascript (taken from one of the examples):

CB('select[fldname="select_var"]').change(function(){
// hide divs
CB('#opt1').css('display','none');
CB('#opt2').css('display','none');
// get selected element
var elemSelected=CB(this).find('option:selected').attr('mv_option');
// check to show divs depends on elem selected
if (elemSelected=='opt1') {
CB('#opt1').css('display','block');
}
if (elemSelected=='opt2') {
CB('#opt2').css('display','block');
}
});

Question:

How do I insert additional variables here? Let say I have additional field-variable opt3, opt4, etc.

I have tried to insert another field-variable "opt3" this way:

CB('select[fldname="select_var"]').change(function(){
// hide divs
CB('#opt1').css('display','none');
CB('#opt2').css('display','none');
CB('#opt3').css('display','none');
// get selected element
var elemSelected=CB(this).find('option:selected').attr('mv_option');
// check to show divs depends on elem selected
if (elemSelected=='opt1') {
CB('#opt1').css('display','block');
}
if (elemSelected=='opt2') {
CB('#opt2').css('display','block');
}
if (elemSelected=='opt1') {
CB('#opt3').css('display','block');
}
});


But it does not seem to work. Please help, since i would like to make more fields working this way.

Thanks!

Re: Conditional Fields (Show/Hide). How to insert additional field-variables? 08.09.2014 18:50

Hello,

If you add a new value in combobox named 'opt3' and you want to hide #opt3, there was something missing in if. Try to change:

if (elemSelected=='opt1') {
CB('#opt3').css('display','block');
}

with:

if (elemSelected=='opt3') {
CB('#opt3').css('display','block');
}



Regards,
Moonsoft Team
www.moonsoft.es

Re: Conditional Fields (Show/Hide). How to insert additional field-variables? 08.09.2014 19:10

Sorry, this was just a typo.

I have used this:

if (elemSelected=='opt3') {
CB('#opt3').css('display','block');
}


But it does not work the way, the other two variables opt1 and opt2 work.

If you try adding additional variable like "opt3" in "Filtered Sections" example - this will not work. What happen is, the selection field correctly shows all three variable in fron end - it is fine. But when you select third variable from fron end menu - the action which is assigned to it (let say "option list" or "date") does not show up. So, the solution is still pending.

Re: Conditional Fields (Show/Hide). How to insert additional field-variables? 08.09.2014 19:19

Hello,

We try to add a new 'opt3' in test environment and seems to be working ok. Are in your page any javascript errors? You could post url here or place a ticket in helpdesk and we'll take a look at your site.

Regards,
Moonsoft Team
www.moonsoft.es

Re: Conditional Fields (Show/Hide). How to insert additional field-variables? 08.09.2014 19:30

No, there is no any eror message.

Here is the page, where I am testing it:

http://gran....

If you select "Test" from the menu - nothing happens. However for "Test" there is an assignment to show the date is selected.

Edited by moon_1794 - 08.09.2014 19:35

Re: Conditional Fields (Show/Hide). How to insert additional field-variables? 08.09.2014 19:35

I found my mistake. I have had a look into the Form Layout and found out that variable OPT3 was not activated.

So it works fine now.

Thanks.
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect
FaLang translation system by Faboba

Our clients' feedback