Hide/Show tabs with condition (radio button or drop-down)
Posted: 2021-01-11 15:04
Hi!
I'm trying to hide/show (or fade in/fade out) some custom tabs according to the value of a field wich is radio button/drop-drown menu (I have tried with both types but the behaviour is always the same).
I have read those threads:
https://appgini.bizzworxx.de/appgini/ap ... p-changes/
https://appgini.bizzworxx.de/appgini/ap ... selection/
and all posts related to custo tabs from https://appgini.bizzworxx.de/.
I have written some code and now I can show the tab I want to when I choose an option (radio button or drop-down menu) but when I save the record, the tab is not saved.
Another strange behaviour is this one: when I choose an option (radio button or drop-down menu), the fields of the tab are shown under the readio button field, not in the tab.
Here is my code:
(tabs 2, 3 and 4 are tabs previously defined)
// tabs not shown when adding the new record
tab2.fadeOut();
tab3.fadeOut();
tab4.fadeOut();
dv.ready(onReady);
function onReady() {
linked_to_init();
}
function linked_to_init() {
var fieldname = "linked_to";
var field = new AppGiniField(fieldname);
// register onChangeHandler (listener)
field.onChange(onLinkedToChanged);
}
function onLinkedToChanged(value) {
hideOrShowFields(value);
}
function hideOrShowFields(value) {
if (value == "risk") {
tab2.fadeIn();
tab3.fadeOut();
tab4.fadeOut();
}
if (value == "opportunity") {
tab3.fadeIn();
tab2.fadeOut();
tab4.fadeOut();
}
if (value == "goal") {
tab4.fadeIn();
tab2.fadeOut();
tab3.fadeOut();
}
}
Thanks in advance
I'm trying to hide/show (or fade in/fade out) some custom tabs according to the value of a field wich is radio button/drop-drown menu (I have tried with both types but the behaviour is always the same).
I have read those threads:
https://appgini.bizzworxx.de/appgini/ap ... p-changes/
https://appgini.bizzworxx.de/appgini/ap ... selection/
and all posts related to custo tabs from https://appgini.bizzworxx.de/.
I have written some code and now I can show the tab I want to when I choose an option (radio button or drop-down menu) but when I save the record, the tab is not saved.
Another strange behaviour is this one: when I choose an option (radio button or drop-down menu), the fields of the tab are shown under the readio button field, not in the tab.
Here is my code:
(tabs 2, 3 and 4 are tabs previously defined)
// tabs not shown when adding the new record
tab2.fadeOut();
tab3.fadeOut();
tab4.fadeOut();
dv.ready(onReady);
function onReady() {
linked_to_init();
}
function linked_to_init() {
var fieldname = "linked_to";
var field = new AppGiniField(fieldname);
// register onChangeHandler (listener)
field.onChange(onLinkedToChanged);
}
function onLinkedToChanged(value) {
hideOrShowFields(value);
}
function hideOrShowFields(value) {
if (value == "risk") {
tab2.fadeIn();
tab3.fadeOut();
tab4.fadeOut();
}
if (value == "opportunity") {
tab3.fadeIn();
tab2.fadeOut();
tab4.fadeOut();
}
if (value == "goal") {
tab4.fadeIn();
tab2.fadeOut();
tab3.fadeOut();
}
}
Thanks in advance