5 Replies Latest reply on Aug 13, 2007 10:28 AM by stuartm1971

    ajax submit and lost styles


      If I use any a4j elements to submit a page which navigates to another page, some of the styleClass application on the new page is lost. Any ideas?

      eg if I submit using a4j:commandButton and the new page contains a commandButton with a styleClass attribute, the styling doesn't work first time into the page.

        • 1. Re: ajax submit and lost styles

          pls post you usecase with more details
          what browser?
          how second page look? Is any different between first and second times?

          • 2. Re: ajax submit and lost styles

            The page I submit is via this control:

            <a4j:commandButton id="srchpage_btn" value="Search" styleClass="button" tabindex="17" action="#{searchParameters.validate}">
            <a4j:support status="testId" event="onclick" />

            I also use it to invoke an a4j:status so I can monitor its progress.

            On the navigated-to page, I have a button:
            <h:commandButton id="selectReceiptBtn" value="Select Receipt"
            action="#{resultsData.validate}" styleClass="button" tabindex="0"/>

            Using the navigation in the searchParameters.validate action attribute, the style of the h:commandButton is lost and some other is applied.
            If I use a normal h:commandButton on the first page this problem doesn't occur.

            I'm aware that using a in the appropriate navigation section of faces-config solves this problem but I'm a little reluctant to use this as redirection creates a new request object.

            Any ideas why using ajax submission should upset the style application of the new button would be helpful, unless perhaps it's just a browser issue(I'm using IE 6.0.29).

            • 3. Re: ajax submit and lost styles

              Some missing text from the last post: '....using a redirect in the faces-config....'

              • 4. Re: ajax submit and lost styles

                Do you mean that styleClass is not "button" anymore or you you css is not applyed?
                Where is your css referred? Did you try to use style instead of styleClass?

                • 5. Re: ajax submit and lost styles

                  The problem still exists if I use style instead of styleClass. It still appears ad a button bu tthe styling of the button's label changes.

                  If I use the 'redirect' attribute in faces-config.xml it solves the problem but this starts a new request, which I feel is a bit untidy.