org.apache.struts2.components.Checkbox
xample/myaction.do?mvc=struts <form id="selectForm"> <sx:autocompleter name="select" list="{'fruits','colors'}" valueNotifyTopics="/changed" /> </form> <sx:autocompleter href="%{jsonList}" formId="selectForm" listenTopics="/changed"/> <sx:autocompleter href="%{jsonList}" id="auto"/> <script type="text/javascript"> function getValues() { var autoCompleter = dojo.widget.byId("auto"); //key (in the states example above, "AL") var key = autoCompleter.getSelectedKey(); alert(key); //value (in the states example above, "Alabama") var value = autoCompleter.getSelectedValue(); alert(value); //text currently on the textbox (anything the user typed) var text = autoCompleter.getText(); alert(text); } function setValues() { var autoCompleter = dojo.widget.byId("auto"); //key (key will be set to "AL" and value to "Alabama") autoCompleter.setSelectedKey("AL"); //value (key will be set to "AL" and value to "Alabama") autoCompleter.setAllValues("AL", "Alabama"); } </script> <script type="text/javascript"> dojo.event.topic.subscribe("/before", function(event, widget){ alert('inside a topic event. before request'); //event: set event.cancel = true, to cancel request //widget: widget that published the topic }); </script> <sx:autocompleter beforeNotifyTopics="/before" href="%{#ajaxTest} /> <script type="text/javascript"> dojo.event.topic.subscribe("/after", function(data, request, widget){ alert('inside a topic event. after request'); //data : JavaScript object from parsing response //request: XMLHttpRequest object //widget: widget that published the topic }); </script> <sx:autocompleter afterNotifyTopics="/after" href="%{#ajaxTest}" /> <script type="text/javascript"> dojo.event.topic.subscribe("/error", function(error, request, widget){ alert('inside a topic event. on error'); //error : error object (error.message has the error message) //request: XMLHttpRequest object //widget: widget that published the topic }); </script> <sx:autocompleter errorNotifyTopics="/error" href="%{#ajaxTest}" /> <script type="text/javascript"> dojo.event.topic.subscribe("/value", function(value, key, text, widget){ alert('inside a topic event. after value changed'); //value : selected value (like "Florida" in example above) //key: selected key (like "FL" in example above) //text: text typed into textbox //widget: widget that published the topic }); </script> <sx:autocompleter valueNotifyTopics="/value" href="%{#ajaxTest}" />