The initial value can be set with "value" if you are setting the options
with "list". If the values are loaded dynamically, then the initial
value cannot be set, this is something that could be done, but I wasn't
sure that it was a good idea, cause maybe the value was not one of the
possible options loaded later. The problem with the values not being
reloaded, definitely a bug. I logged all this on this ticket:
https://issues.apache.org/struts/browse/WW-1562
please add there anything else that you find
regards
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]