Java Mailing List Archive

Home » Home (12/2007) » Struts 2 »

about linking two autocompleters using topics [never surrender :)]

Giovanni Azua




I have been recently asking how to achieve that changing the value of
autocompleter A, triggers an Ajax reload of autocompleter B and make
the only item returned as selected on B i.e. displayed in its textInputNode.

I followed directions from:

and the reload works okay but making the only element in the ComboBox
selected and displayed in autocompleter textInputNode is the remaining

Trying to hack some javascript that will do, below is the code to the
closest I've got.
I manage that after the reload the autocompleter displays "kaki" big
deal! but not yet
to display the only item out of the ComboBox.

Ehh please help :)


***************************** mypage.jsp ****************************

<script type="text/javascript">
dojo.event.topic.subscribe("/after", function(data, type, request)
  //data : text returned from request
  //request: XMLHttpRequest object
  //widget: widget that published the topic
  // alert(widget.optionsListNode.childNodes.length);
  // alert('happened');
  if (type == "load")
     var widget = dojo.widget.byId("eurosPerListedUnit0");
     widget.textInputNode.value = "kaki";
  // widget.textInputNode.value = widget.comboBoxValue.value;

<s:url var="exchangeRates" action="AjaxGetExchangeRates.action" />

<s:form id="formSimulation" action="%{targetAction}" method="post"
  <sx:autocompleter tooltip="Provide the first Historic Book"
valueNotifyTopics="/changedHistoricBook0" searchType="substring"
label="Historic Book 1" cssStyle="width: 250px;" dropdownHeight="180"
name="historicBook0" list="historicBooks" listKey="id" listValue="name"
  <sx:autocompleter id="eurosPerListedUnit0" tooltip="Provide the
Currency Rate 1" formId="formSimulation" href="%{#exchangeRates}"
    label="Currency Rate 1" cssStyle="width: 250px;"
name="eurosPerListedUnit0" autoComplete="false" notifyTopics="/after" />
  <s:submit value="%{buttonLabel}" align="center"/>

To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.