Results 1 to 5 of 5

Thread: trigger decorated event failed in IE

  1. #1
    Join Date
    Nov 2010
    Posts
    12

    Default 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 at 02:29 AM.

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    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
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    Nov 2010
    Posts
    12

    Default

    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

  4. #4
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,796

    Default

    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
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  5. #5
    Join Date
    Nov 2010
    Posts
    12

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •