updateField action event type

2005-09-25
2013-01-31
  • Hello,

    can i change the the event that fires the updateField action from click to change of input field? can the action be triggered by an input field was already assigned to the autocomplete tag?

    Netanel
    netanelwe AT gmail.com

     
    • You should be able to do this.  Try setting the eventType property on the updateField tag.  Acceptable values for this property include the standard JavaScript events minus the 'on' prefix.  For instance, try "click", "mouseover", "focus", etc.

      -Darren

       
      • Alex Kayser
        Alex Kayser
        2007-01-23

        I need use the onChange event, no button. Than, I make this:

        <input type="text" id="mph" id="action"/>

        <ajax:updateField
          eventType="change"
          baseUrl="/ajaxTags/formupdate.view"
          source="mph"
          target="kph,mps"
          action="action"
          parameters="mph={mph}"
          parser="new ResponseXmlParser()"
          preFunction="initProgress"
          postFunction="resetProgress" />

        But don't work... When is the error??

         
        • How come no one has ever posted a solution to this problem????
          thx

           
          • earlofsiberia
            earlofsiberia
            2007-09-28

            The updateField tag only appears to be working with onclick eventtype.

            I have managed to mimic a button click using javascript. Here is the code:

            **Note that you have to do this differently for IE and DOM compliant browsers e.g. Firefox:

            function mimicClick() {
            if(chckBrowser()=='msie') //check the browser type
            document.Form.action.click(); // Only works with IE (where 'action; is your button name)
            else{
            simulateClick(); // If not IE call the simulate click method
            }

            }

            function simulateClick() {
              var evt = document.createEvent("MouseEvents");
              evt.initMouseEvent("click", true, true, window,
                0, 0, 0, 0, 0, false, false, false, false, 0, null);
              var el = document.getElementById("action");
              el.dispatchEvent(evt);
              el.click && el.click();

            }

            <input id="action" name="action" type="button" value="Calculate"/>

            <ajax:updateField baseUrl="<%=servletURL %>" source="rrp"
                target="psd,lct" action="action"
                parameters="requireddate={requireddate},stateofuse={stateofuse},rrp={rrp},model={model},calculate='true'"
                parser="new ResponseXmlParser()" eventType="click" />

             
        • Any Resolution for this ?

           
    • Darren:
           I am also having same kind of issue. Searching through the message log found this one. I am trying to use "blur" event type so that once textbox looses focus, i want to fill the other relevant fields. Even thought i specified "eventtype", it is still responding to "onClick" on the "action" that was defined. Here "action" is the field1. Please suggest.

      Thanks
      Caro

       
    • Darren:
          I found the problem/feature. In ajaxtags1.1.js for the updateField actionType is hardcoded to "Click" which is causing this problem. I changed it to "blur" and everything is solved.
          Is there any reference documentation on the javascript like how to debug or where to start and follow up if i want to debug and change whereever required to my needs.

      Thanks
      Caro

       
      • Very true.  That bit of hardcoding is a bug--we should be delegating to the eventType property set on the JSP tag.  I'll make sure a fix gets into the next release.

        As to debugging JavaScript, I use Firefox's JavaScript Debugger extension, also known as the Venkman extension.  For IE, there is a script debugger distributed by Microsoft: http://msdn.microsoft.com/library/en-us/sdbug/Html/sdbug_1.asp

        We always encourage people to debug as much as possible before posting to the forums.  When you do post, it's best to indicate the browser and version along with any JS errors and code line numbers.  Relevant code (no need to post the entire page) is important, too, because we can see if there are any mismatches between JSP-HTML or HTML-JavaScript.

        -Darren

         
    • Yogesh
      Yogesh
      2009-06-15

      please tell me anyone how to use
      parser="new ResponseXmlParser()"

      what it required to convert to ResponseXmlParser

      thanks..