3 Replies Latest reply on Nov 3, 2009 7:59 PM by cash1981

    Strange AJAX behavior

    oneworld95

      Hi. I've wired up some radio buttons to show/hide two Seam SPAN tags. Two issues exist:



      1. It takes a few seconds before it shows/hides the correct SPAN tag.

      2. When you submit and then click the back button on the browser and return to the page, the radio buttons have the correct value selected (the one the user chose), but the incorrect SPAN tag is showing. You have to select the other radio button and then change for it to show the correct SPAN tag.



      Here's the selectOneRadio control:


      <h:selectOneRadio value="#{webencode.requestType}" 
        id="rdoRequestType" styleClass="radio" style="width:195px" layout="pageDirection" >
        <f:selectItem itemValue="program" itemLabel="Series or Program"/>
        <f:selectItem itemValue="special" itemLabel="Special"/>
        <a4j:support ajaxSingle="true" event="onclick" reRender="program" />
      </h:selectOneRadio>



      Here are the SPAN tags:


      <a4j:outputPanel id="program" ajaxRendered="true">
        <s:span rendered="#{'program' == webencode.requestType ? true : false}">.....</s:span>
        <s:span rendered="#{'special' == webencode.requestType ? true : false}">.....</s:span>
      </a4j:outputPanel>



      Am I doing something wrong here? Thanks.

        • 1. Re: Strange AJAX behavior
          cash1981

          I think it depends on your backing seam component. I bet webencode is Event type. Try having it as @Stateful or Conversation (which survives redirect) or higher (session, application), then it should be able to have the same state.

          • 2. Re: Strange AJAX behavior
            oneworld95

            Thanks, Shervin. The class file already has the following:


            @Name("webencode")
            @Scope(SESSION)
            public class WebEncodeRequestAction implements Serializable{
            ...
            }
            

            • 3. Re: Strange AJAX behavior
              cash1981

              Hmm thats strange. We do something similar on our search page. Our component is SESSION scope and it work fine. What happens if you don't push the back button but through normal get/post? Does it work then?