Announcement Announcement Module
Collapse
No announcement yet.
trigger decorated event failed in IE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • trigger decorated event failed in IE

    Hi All,

    I am facing a problem. I have a form with a submit input field:


    Code:
         <form action="myAction" method="POST" name="formID" id="formID">
                     <input type="button" style="display:none" title="showTaskBtn" name="showTaskButton" id="showTaskButton" value="showTask" />
             </form>
             <script type="text/javascript">
              Spring.addDecoration(new Spring.AjaxEventDecoration({
                                                            elementId: "showTaskButton",
                                                            formId:  "formID",
                                                            event: "onclick",
                                                            params: {fragments: "body"}
                                                            }));
              </script>
    For some reason I want to trigger the showTaskButton event automatically to do the partial render by:
    Code:
      $(document).ready(function () {
             $("#showTaskButton").trigger('click');
      }

    This code is working in FF but not working in IE, any idea? Thanks in advance.

    Tony
    Last edited by tonytaotao; Apr 6th, 2011, 03:29 AM.

  • #2
    Hello

    This code is working in FF but not working in IE, any idea?
    Which version is IE?

    Even if work with FF I suggest you something about your jQuery code, for your id element bind the event first (you missing that) and then trigger the event

    Check jQuery documentation for more details

    HTH

    Comment


    • #3
      Hi dr_pompeii

      Thank you for the reply. If I put:
      Code:
      $(document).ready(function () {
       
       $("#showTaskButton").bind('click', function(){
                        alert('clicked');
       });
       $("#showTaskButton").trigger('click');
      }
      The partial render is still not working in IE (working in FF). It will work if I manully click the button. And the alert will popup on both way (clicking button and loading page). Any idea? Cheers.

      Tony

      Comment


      • #4
        Hello Tony

        The partial render is still not working in IE (working in FF).
        OK

        Your code seems be totally correct, I just checked with my books

        I have a suggestion

        Code:
        $(document).ready(function () {
         
         $("#showTaskButton").bind('click', function(){
                          alert('clicked');
         });
         $("#showTaskButton").trigger('click');
        }
        The code above now change it for a new simple HTML element in your jsp page ( a simple input text) nothing related with AjaxEventDecoration or with Spring, just a simple HTML element,
        something like

        Code:
        $(document).ready(function () {
         
         $("#showTaskButtonAltern").bind('click', function(){
                          alert('clicked');
         });
         $("#showTaskButtonAltern").trigger('click');
        }
        You could get the follow cases:

        1) not work, then try it with Opera and Google Chrome, if work the blame is for the IE, then I suggest you post this in jQuery forums, could be a bug, or need special extra configuration to work with IE

        2) if work, then the problem is that jQuery cant work sadly with
        Code:
        Spring.addDecoration(new Spring.AjaxEventDecoration({
                                                                elementId: "showTaskButton",
                                                                formId:  "formID",
                                                                event: "onclick",
                                                                params: {fragments: "body"}
                                                                }));
                  </script>
        Now I did realize the follow, really about the code shown above, what html element represent?


        Let me know your advance

        Comment


        • #5
          Hi dr_pompeii,

          Thank you for the suggestion. I change it for a new simple HTML element:
          Code:
          <input type="button" onClick="return confirm('Are you sure you want to reset the form?')" style="display:none" title="showTaskBtn" name="showTaskBtn" id="showTaskBtnAltern" value="showTask" />
          and this:

          Code:
           $(document).ready(function () {
          $("#showTaskBtnAltern").trigger('click');
          }
          working on both IE and FF.

          Also, I used native js to simulate input click

          Code:
          document.getElementById('showTaskBtn').click();
          It only work on FF. I don't think it is something wrong with JQuery. It looks like the simulate on event click is not working with element related with AjaxEventDecoration. Any idea? Many thanks.

          Tony

          Comment

          Working...
          X