question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TabView/AccordionPanel: error indication

See original GitHub issue

When you have a TabView with multiple tabs on which validation can fail, it is really handy that the tabs on which errors occur, get an error highlighting. For this, we use the following Javascript within our project:

function markInvalidTabs(id) {
    id = PrimeFaces.escapeClientId(id);
    let c = $(id + '>ul>li');
    c.each(function () {
        let d = $('a', this);
        let tid = d.attr('href').substring(1);
        tid = PrimeFaces.escapeClientId(tid);
        let uiStateErrorElements = $(tid + ' .ui-state-error');
        let uiMessageErrorDetailElements = $(tid + ' .ui-message-error-detail');
        if (uiStateErrorElements.length + uiMessageErrorDetailElements.length > 0) {
            $(this).addClass('ui-state-error');
        } else {
            $(this).removeClass('ui-state-error');
        }
    });
}

and hence we call this method after an AJAX update, with id the TabView identifier. It would be cool if this would be the default behavior of TabView.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:20 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
fcornelicommented, Aug 2, 2022

@melloware Created ticket #9054 for the focusOnError feature.

1reaction
fcornelicommented, Aug 1, 2022

@melloware Indeed, that’s one of the reasons why I had ui-message-error-detail in the original code. Maybe this could be added again? Won’t hurt I guess…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Primefaces Accordion and TabView issue after open
I have problem with Primefaces Accordion and TabView. When i put TabView with 2 and more Tabs into Accordion panel and open my...
Read more >
USER GUIDE 6.2 - PrimeFaces
AccordionPanel is a container component that displays content in stacked format. ... Boolean Containers components like, datatable, panel, tabview skip.
Read more >
Index (primefaces 5.3 API) - javadoc.io
Configure an AtmosphereResource and creates channel of communication on the fly. applyAttachedObject(FacesContext, UIComponent) - Method in class org.primefaces ...
Read more >
AJAX basics with Process and Update | PrimeFaces Cookbook
By grouping components for validation, errors that would arise from other ... composite JSF components along with <p:tabView> , <p:accordionPanel> ...
Read more >
accordion « PrimeFaces « JSF Q&A - Java2s.com
Hello, I have a problem with my accordionPanel with two tabs and required fields ... Hello, I saw tabview component had its issue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found