how to set Tab selected value


Badge +4

hi All,

may i know how can i select a different tab when i click on a button (client click).

example, in my form i got 3 tabs (Tab A, Tab B and Tab C).

in Tab A, if i click on 'Next' button, i want to go to Tab B.

thanks


15 replies

Userlevel 5
Badge +14

have a look on this  

Badge +4

hi Marian,

its not fully working, the panel of the desired tab show correctly but the option button still remain as the old selection.

eg.

By default Section A is selected, when i click on 'Next' button, the panel changed to Section B's panel. but the selection on the option buttons still remain as Section A instead of Section B. Do you have any suggestion ?

here is my javascript function

function showtab(sectionid){ var rad = NWF$('#' + Section);
rad.find('input')[sectionid].checked = true;
NWF.FormFiller.Functions.ProcessOnChange(rad);

Thanks

Userlevel 5
Badge +14

what type of control do you use for tab buttons?

can you post its configuration?

Badge +4

Hi Marian,

i am using “checkbox - option buttons” in the nontex form.

thanks

Userlevel 5
Badge +14

I guess you meant "Choice - option buttons", right?

do you render it as radio or buttons.

Badge +4

Yes Marian, i render as buttons.

but default, Section A is selected ('the background changed to white color, other tabs is grey'.)

and when i click on next button using the javascript function above, the panel of the tab show correctly, but the selected tab still remain as Section A (it supposed changed to Section B as well).

thanks

Badge +4

Hi All,

please find image below to understand more about my current problem.

thanks

Userlevel 5
Badge +14

then try following code

function showtab(sectionid){ 
    var rad = NWF$('#' + Section);     
    NWF$(rad.find('label')[sectionid]).click();
} ‍‍‍‍‍‍‍‍‍‍‍‍

‌ option buttons‌ rendered as buttons‌ ‌ tab like functionality‌

Badge +4

hi Marian,

yes, this is working.

thanks alot

Badge +2

Hi Marian,

I have a similar problem with 3 tabs and a "Next Section" JavaScript Button that should activate the next tab.

Is your code above intended to be entered in the Client Click section of the button? Can you explain sectionid and section in a bit more detail? My Tabs are storing their Client ID in a JavaScript variable named varFormTabs. How is this variable used in your code?

Thanks for your help!

Best regards,

Harald

Userlevel 5
Badge +14

Is your code above intended to be entered in the Client Click section of the button?

no, it should be placed into form setting - custom javascript, or stored in a separate .js file somwhere on sharepoint and linked to form in form settings - avanced

Can you explain sectionid and section in a bit more detail?

I just taken over John's naming.

but Section is javascript variable of tab switching control (equivalent of your varFormTabs) and sectionid is zero based sequential number of a tab/button.

Badge +2

Hi Marian,

thank you for your answer. I am still facing some issues setting it up.

I inserted the function into the custom JavaScrip section of the form settings as follows:

function showtab(varFormTabs){
    var rad = NWF$('#' + Section);     
    NWF$(rad.find('label')[varFormTabs]).click();
}

And then I am calling the function from the Client click section of the JavaScript button as follows:

showtab()

But when I test it after publishing the form, the form just reloads and displays the default panel - which is an indicator for an error in the JavaScript. I don't have a lot of experience with JavaScript. Could you help me getting this to work?

Thanks a lot!

Harald

Userlevel 5
Badge +14

, please start new question for your specific problem.

this question thread is already closed and it might get confusing discussing several problems at one place.

Badge +5

Thanks this was super helpful. My tab button had a forward slash/special character in it ("/") and would not work on load out of the box (had it working fine with other labels).

Here's my example which works on page load (added into a JS file in the style library so I can easily debug it, and then added into the custom JS includes), hopefully adds some more context for people.

NWF.FormFiller.Events.RegisterAfterReady(function () {
      var tabControlButtons = NWF$('#' + tabButtons); // tabButtons = the clientID I gave my tab control
      NWF$(tabControlButtons.find('label')[0]).click(); // leave label, this is looking for all HTML labels produced by the Nintex form inside the tab control, in this case the labels are our choices that we put into the tab control. The index after it then selects which label you want out of the number of options you put on your control, in my case I wanted to load the first tab by default on load.
});

Badge

I don't see anywhere in the thread what to put in the  "Client click" field of the button.  If I leave it blank I get an error: The "Client click" property is required when "Button Action" is "JavaScript.  Thank you.

Reply