Make specific tab active on load

Hi!

Doctype has say 3 tabs. On load of it i would like to make particular tab active say 2?
Is there any JS code to do it? Thanks!

You should be able to set the focus on on of the fields on tab 2.

Thanks @volkswagner is there any frappe JS to do focus on particular field

Maybe something like:

frm.tabs.find((tab) => tab.df.fieldname === "my_tab").set_active();

This might become easier in the future v16 with:

This post might help.

Hi @ashish-greycube:

Try this.

frm.scroll_to_field("your_field")
Where your_field should be the first field of your destination tab.

Hope this helps.

Thanks! everyone @volkswagner @corentin and @avc
I found the unique anchor tag of tab and have made it click via jquery

> let current_tab_id=cur_frm.get_active_tab()?.wrapper[0].id
> let current_tab_fieldname=cur_frm.get_active_tab()?.df.fieldname
> $(`.nav-link[aria-controls=${current_tab_id}][data-fieldname=${current_tab_fieldname}]`).click()