Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 - linked autocompleter problem

 
Bill Luhtala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have 2 autocompleters on my form. After changing the value of 1st combobox (call is cb1) , the values of 2nd combo box should be changed.

This works great when I use the drop down control to change the value of cb1. The options in cb2 are changed. Problem is that when I type in the value into cb1, the ajax call to re-populate cb2 doesn't fire. It only fires if I use the drop down control to change the value in cb1. Am I missing something obvious?

Here's what my setup looks like. Thanks for any help you can give.

<s:url var="jsonList" value="/AjaxPopMyCycle.action"></s:url>
<form id="selectForm">
<sx:autocompleter
name="marketCode"
list="{'M01','M02','M03','M04','M05','M06'}"
value="M01"
valueNotifyTopics="/Changed"
forceValidOption="true"
autoComplete="true"
loadOnTextChange="true"
/>
</form>
<sx:autocompleter
name="cycleDate"
href="%{jsonList}"
autoComplete="false"
formId="selectForm"
listenTopics="/Changed"
forceValidOption="true"

/>
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try setting the "loadOnMinimumCount" attribute? IIRC it defaults to 3; maybe there's an off-by-one error or something?
 
Bill Luhtala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added that, and now I undestand that it is really meant for a single autocompleter only, so that the list of values to choose from for the current list is reduced with each key stroke. So when you get to the end of the characters in the value, there is no need to perform the ajax query, since you've obviously already four your value. I can see the call to the server with first M, then M0

But for what I'm trying to do, I'm not autocompleting cb1, but setting up the values in cb2. The user wants to be able to either type in the value or select from the drop down, in each of the two combo boxes.

Any other ideas?

Thanks,
Bill
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, right; my bad.

Hmm, not sure--you might be able to use one of the notifyTopics variations on autocompleter #1 and link it to a listenTopic on autocompleter #2, at least that's the approach I'd try first. The Dojo 0.4.mumble docs might help (they're a minor PITA to find, but they're still available) but... they might not--they're not on the same level as more recent Dojo versions.
 
Bill Luhtala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

I'm using struts2-dojo-plugin-2.1.6.jar.

Is this still 0.4 or is it 1.0?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
0.4.mumble--the upgrade to Dojo 1.0 was too massive, and the ROI too low. The Dojo tags have all been deprecated, in fact, as ultimately it's more reasonable to just use straight Dojo.

There may be a limited-functionality set of Ajax tags in future releases, hopefully supporting a wider range of JS libraries.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic