It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confiforms Tabbed View in Dialog Mode

I am trying to used a tabbed view in my form. But I am finding that when the form is viewed in dialog mode and not embedded in the page, the tabs will not work. I am using Confiforms and for the tabs using HTML Elements plugin (I have tried other plugins as well). When the form is embedded on the page, it works with no problem. 

 

Is there anyway to initialize these tabs when the form is in dialog mode and not just when it is embedded on the page? Any help is appreciated! Thanks!

 

 

2 answers

2 accepted

Davin Studer Community Leader Jan 18, 2019

Thanks sir.

0 votes
Answer accepted

I'm seeing the same behavior. I've tried a number of things and cannot seem to get it to work either. I even tried re-initializing the tabs after the dialog has opened using AJS.tabs.setup(); and that didn't work either. It probably has something to do with how they are dynamically adding the form when the dialog opens. I would suggest raising a suggestion with Vertuna. They are pretty responsive to suggestions.

Davin Studer Community Leader Jan 08, 2019

I think it has to do with the fact that when you use a ConfiForm via dialog mode the html elements that make up the form are duplicated in the page source. Thus there are two sets of tabs on the page with the same ID, which I think is confusing the AUI tabs.

Davin Studer Community Leader Jan 08, 2019

After messing around a bit I'm pretty sure this is indeed the issue. I manually changed the ID's in the page source after the page has loaded and the dialog opened and I was able to get the tabs to work.

Hi Davin - 

Reaching out to Vertuna, was told that if I know what needs to be called to initialize the tabs, then I can easily add the Javascript calling Confiforms Field Definition rule and do it every time the form is initilized. Which kind of sounds like what you did in your first comment, right?

Davin Studer Community Leader Jan 08, 2019

That is what I did and that is not the issue. The issue is that when you do a form in dialog mode it creates the form on the page in a hidden fashion and when you click the button to open the dialog the form's DOM (document object model) is cloned which ends up duplicating the id's on the page. This is an HTML no no. There should never be multiple DOM nodes with the same id because when you try to target that node via JavaScript odd things can happen as it does not know which node you are referring to. I verified this by opening up the page source and manually changing the tab id's in the dialog box to be unique. When I did that the tabs started working.

Davin Studer Community Leader Jan 18, 2019

So, the JavaScript code in the article that Alex provided will not work for the Keysight tabs, which are really just based on the Atlassian AUI tabs. I have modified his JavaScript function to work with the Keysight app. The below script just modifies the tab ids within the popped up form,  re-points the tab anchors, and then re-initializes the tabs. This should work for top-level and nested tabs.

<script type="text/javascript">
function initTabs(formId) {
    AJS.$('#' + formId + ' .aui-tabs .menu-item a').each(function(){
        AJS.$(this).attr('id', AJS.$(this).attr('id') + '-cloned');
        AJS.$(this).attr('href', AJS.$(this).attr('href') + '-cloned');
    });

    AJS.$('#' + formId + ' .aui-tabs .tabs-pane').each(function(){
        AJS.$(this).attr('id', AJS.$(this).attr('id') + '-cloned');
    });

    AJS.tabs.setup();
}
</script>

Thank you Davin!

I believe this shall work with Navitabs app as well, as it is also based on AUI tabs component from Atlassian

Davin Studer Community Leader Jan 21, 2019

Yep, it should work with Navitabs as well.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Confluence Server & Data Center 7.0 is here!

Hello Community 👋🏼 I’m Makisa, a product manager on Confluence Server and Data Center. Confluence Server & Data Center 7.0, our latest platform release, is now available and we wanted to shar...

165 views 0 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you