Making the autocompleter reload its content while typing was easier than expected :). Do you think it would be better to have that behavior , or the current one, by default?

musachy

Dariusz Wojtas wrote:
Hi,

I am using Struts 2.0.2, trunk.

I have an action (/listy/kodyPocztowe) that returns postal codes [id, name] and another action that server a form (form points to the same action back).

How to define the initial value in the autocompleter field?
Even if I submit the form and it reloads with the same action, the
autocompleter does not display previously selected option.

I tried to use a javascript (shown below) to debug it (print field names).
When an alert shows, in place of autocompleter I can see plain
textfield with resubmitted values (as expected), after alert messages
do finish it is replaced by the autocompleter widget - empty value,
nothing selected. the widget is loaded with options, but none is
selected.

Any hint how to solve this mistery?
What am I missing?


<script type="text/javascript">
 function filterKodPocztowy(field) {
   alert(field.name);
    return field.name == "kodPocztowy";
 }
</script>

<s:form id="calcForm" ...>
  [...]
  <s:url id="kodPocztowyURL" value="/listy/kodyPocztowe.action" />
  <s:autocompleter name="kodPocztowy"
    theme="ajax"
    href="%{kodPocztowyURL}"
    forceValidOption="true"
    formId="calcForm"
    formFilter="filterKodPocztowy"
    />
  [...]

  <s:submit .../>
</s:form


Dariusz Wojtas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to