5 Replies Latest reply on Sep 26, 2007 7:11 AM by Sergei Konovalov

    Problem with a4j:support

    Sergei Konovalov Newbie

      I have the problem with sending request and getting response with using a4j:support. All requests, that sending to the server, works correctly. Except, second request. At this time, data not saving to database. I see the request and response content. Did somebody meeting with this problem?
      P.S. Excuse me for my English.

        • 1. Re: Problem with a4j:support
          Ilya Shaikovsky Master

          please paste actual the code. And info about your runtime.

          • 2. Re: Problem with a4j:support
            Maksim Kaszynski Apprentice

            Could you please attach the code snippet?

            • 3. Re: Problem with a4j:support
              Sergei Konovalov Newbie

              Code:
              <h:inputText id="colorInput" style="border: 1px solid white; font-size: 10px;" value="#{row.val}"
              onclick="editCat(this.id)" onblur="retSpan(this.id)" onkeypress="checkKey(event, this.id)" size="10">
              <a4j:support id="newCategorie" event="onchange"
              reRender="categorie:controlform:catTable:colorHead"
              requestDelay="100"
              ajaxSingle="true"
              disableDefault="true"
              onsubmit="alert('submitted')"
              oncomplete="alert('completed')"
              actionListener="#{Calendar.addCategorie}">
              </a4j:support>
              </h:inputText>
              Runtime:
              Jboss 4.0.4.GA, java 1.5.0_06.
              I don't now why the second request differ from another all. This is cybernetics I think :)

              • 4. Re: Problem with a4j:support
                Ilya Shaikovsky Master

                check please client side info from a4j:log and server side info about phases execution (using phasetracker)

                • 5. Re: Problem with a4j:support
                  Sergei Konovalov Newbie

                  I checked client side info with a4j:log and find a strange thing. In response I get this text:
                  script type="text/javascript" src="/public/a4j.res/org/ajax4jsf/renderkit/html/scripts/form.js.faces"> /script>
                  This text generates only at the time, when data not saved in database.
                  Script:

                  if(!window.A4J){window.A4J={};}
                  if(!A4J.findForm){
                  function _JSFFormSubmit(linkId,formName,target,parameters){
                  var form=document.getElementById(formName);
                  if(form){
                  var hiddenField=form.elements[formName+":_idcl"];
                  if(hiddenField){hiddenField.value=linkId;}
                  else{var input=document.createElement("input");
                  input.type="hidden";input.name=formName+":_idcl";
                  input.value=linkId;form.appendChild(input);
                  }
                  if(target){form.target=target;}
                  if(parameters){for(var param in parameters){if(form.elements[param]){form.elements[param].value=parameters[param];}else{var input=document.createElement("input");input.type="hidden";input.name=param;input.value=parameters[param];form.appendChild(input);}}}
                  form.submit();}else{alert("Form "+formName+" not found in document");}
                  return false;};function _clearJSFFormParameters(formName,target,fields){var form=document.getElementById(formName);if(form){if(target){form.target=target;}else{form.target='';}
                  if(fields){for(var i=0;i<fields.length;i++){var field=form.elements[fields];if(field){field.value='';}}}}}
                  function clearFormHiddenParams(formName,target,fields){_clearJSFFormParameters(formName,target,fields);}
                  A4J.findForm=function(element){var parent=element;do{parent=parent.parentNode;}while(parent&&parent.nodeName.toLowerCase()!='form');if(!parent){parent={reset:function(){},submit:function(){}};}
                  return parent;}
                  A4J._formInput=null;A4J.setupForm=function(id){var element=window.document.getElementById(id);var name="click";if(element.addEventListener){element.addEventListener(name,A4J._observer,false);}else if(element.attachEvent){element.attachEvent('on'+name,A4J._observer);}}
                  A4J._observer=function(evt){var src=evt.target||evt.srcElement;if(src&&src.nodeName.toUpperCase()=='INPUT'&&src.type.toUpperCase()=='SUBMIT'){A4J._formInput=src;}else{A4J._formInput=null;}}}
                  I think this script updating the form. But updating another form in my opinion.