6 Replies Latest reply on Nov 15, 2007 5:52 AM by Ilya Shaikovsky

    a4j:support

    diet ice Newbie

      Hi ,

      I cant get the following code to work can someone offer some assistance on where I am going wrong.

      <a4j:region selfRendered = "true">
      <a4j:form jsfc = "h:form" id = "productForm">
      
      <t:outputLabel for = "exVAT" value = "#{text['product.exVAT']}" styleClass = "desc"/>
      <a4j:outputPanel ajaxRendered = "true">
       <t:inputText styleClass = "txtboxes" size = "4" required = "true" id = "exVAT"
       value = "#{productForm.product.wholesaleExVAT}">
       <a4j:support event = "onblur" reRender = "vat"></a4j:support>
       </t:inputText>
      </a4j:outputPanel>
      <h:outputText/>
      
      <t:outputText value = "#{text['product.incVAT']}" styleClass = "desc"/>
      
      <t:outputText styleClass = "" id = "vat" value = "#{productForm.product.wholesaleVAT}" style = "color: blue;">
       <f:convertNumber type = "currency" currencySymbol = "&#163;"/>
      </t:outputText>
      
      <h:outputText/>
      </a4j:form>
      </a4j:region>
      
      
      


      It should update the vat value after I have entered exVat value. But nothing happens.
      This is the code for #{productForm.product.wholesaleVAT}

      public double getWholesaleVAT() {
       this.wholesaleVAT = this.getWholesaleExVAT() * VAT + this.getWholesaleExVAT();
       return wholesaleVAT;
       }
      


      Any help would be appreciated.

      Thanks

        • 1. Re: a4j:support
          Damian Harvey Master

          When you say "nothing happens", do you see anything in your logs? Ie: do they move at all? Is productForm.product instantiated?

          Try a simpler repeater example that will just output what you type in:

          <h:form>
           <h:inputText value="#{productForm.product.wholesaleExVAT}">
           <a4j:support event="onblur" reRender="vatDisplay"/>
           </h:inputText>
           <h:outputText id="vatDisplay" value="#{productForm.product.wholesaleExVAT}"/>
          </h:form>

          Once you have that going it's not hard to expand on it to where you want to get to.

          Cheers,

          Damian.




          • 2. Re: a4j:support
            Scott Ryan Newbie

            The issue is that the code works fine without the repeater and calls my listener correctly allowing me to perform the required function. When I add the repeater the action listener is no longer invoked. I can add and remove the repeater at will and the action is the same. I also tried using the facelets ui:repeat and many combinations of a4jsf and non a4jsf command buttons and links with the same response. I noticed in your example there is not repeater code however the example works so it seems to be something with using command button or command link that is causing the issue. I had attached the full code and logs to the original post. I am not sure how to debug this since it appears that the log does not indicate an issue in either case it is just that my listener is never called.

            I will continue to try to debug but if you have more suggestions that would help me isolate the issue I can try those. It looks like adding the repeat disables the ajax actions.

            • 3. Re: a4j:support
              Scott Ryan Newbie

              Sorry ! my last post went to the wrong topic. I can't figure out how to erase the post. I apologize for the wrong posting.

              • 4. Re: a4j:support
                diet ice Newbie

                There are a few required fields on the form and I find that if they are filled in then the code works otherwise I get nothing. How can I skip validation when using

                <a4j:support event = "onblur" reRender = "vat"></a4j:support>
                


                Thanks

                • 5. Re: a4j:support
                  diet ice Newbie

                  using

                  ajaxSingle="true"
                  


                  gives me what I want. I tried
                  immediate="true"
                  


                  but my value doesn't get updated. Why would that be?

                  Thanks..

                  • 6. Re: a4j:support
                    Ilya Shaikovsky Master

                    you should use ajaxSingle or a4j:region around the control.

                    About immediate - works as it should. Just read about it in JSF articles.