« Return to Thread: Extra Click Event

Re: Extra Click Event

by vikas patil :: Rate this Message:

Reply to Author | View in Thread

Hi Peter,
            You could try these things:

1. Check if you are getting the exact button element just before you associate the connect event.
2. Check if the dojo.connect returns the right value(some array descrining your onchange event and its associated elements)
3. Try doing awindow.onload, bcz I have faced some similar problems with the dojo.onload() but it was long back.

Thanks and Regards,
Vikas A Patil  

On Fri, Jun 6, 2008 at 10:08 AM, pczurak <CZUPET@...> wrote:

I have the following code and the problem I am having is after I select an
item from the combo box which causes an OnChange event like it should but
then if I click anywhere on the screen I get a second OnChange event from
the combo box, how do I prevent this extra  OnChange event

Thank You

Peter


<!-- The Code -->

<html>
   <head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <title>QueryReadStore Demo</title>
       <style type="text/css">
               @import "dojo-release-1.1.1/dijit/themes/tundra/tundra.css";
               @import "dojo-release-1.1.1/dojo/resources/dojo.css"
       </style>

       <script type="text/javascript" src="dojo-release-1.1.1/dojo/dojo.js"
djConfig="isDebug: true, parseOnLoad: true"></script>
       <script type="text/javascript">
           dojo.require("dijit.form.ComboBox");
           dojo.require("dijit.form.FilteringSelect");
           dojo.require("dojox.data.QueryReadStore");

           dojo.provide("ComboBoxReadStore");
           dojo.declare(
               "ComboBoxReadStore",
               dojox.data.QueryReadStore,
               {
                   fetch:function(request) {
                       request.serverQuery = {q:request.query.name};
                       return this.inherited("fetch", arguments);
                   }
               }
           );


       function update_cbox_store() {
               // get the combobox widget with id my_combo_box
               cbox = dijit.byId('fs');
               // create new data store - update URL as needed
               new_store = new ComboBoxReadStore({url: 'States2.txt'});
               // assign new data store to combobox, should refresh with new
               // server data
               cbox.store = new_store;
               alert("cbox " + cbox);

       }


       dojo.addOnLoad( function () {
               dojo.connect(dojo.byId('foo'), 'onclick', update_cbox_store);
       }) ;


       function setVal2(val)
       {
               alert("val= " + val);
       }

       </script>
   </head>
   <body class="tundra">
       <div dojoType="ComboBoxReadStore" jsId="store"

url="dojo-release-1.1.1/dojox/data/tests/stores/QueryReadStore.php"
            requestMethod="get"
            >
       </div>
       State: <input id="fs" dojoType="dijit.form.FilteringSelect"
store="store" pageSize="15" OnChange="setVal2" style="width: 300px;
font-size: 10pt;"/>
       <button id="foo" >Click Me!</button>
   </body>
</html>

--
View this message in context: http://www.nabble.com/Extra-Click-Event-tp17684530p17684530.html
Sent from the Dojo mailing list archive at Nabble.com.

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...

http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest



_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest

 « Return to Thread: Extra Click Event