Java Mailing List Archive

http://www.junlu.com/

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

Re: [S2] autocompleter, predefining initial value

Dariusz Wojtas

2006-12-28

Replies:

Hi Musachy,

I tried as you advised.
Works, no more exceptions and the values are set as expected.

But there is still some little problem with preloading.
Now I have properties
 private String carMaker = "AUDI";
 private Integer carMakerKey = 354;
with hardcoded initial value, just for test.
I open my page and the value is preloaded as expected. AUDI is shown.
I submit the form - params are filled as expected. AUDI and 354.

But If I open such page [the same values preloaded] and just click
somewhere in that autocompleter [no changes] and leave the field - the
value is lost.
Some event is generated that causes fresh reload of the field.
Submitted form shows both properties empty.

One little other issue is that if carMaker is preselected on load,
then the dependent autocompleter (carModel) is not preloaded with
options. I have to change carMaker to make carModel loaded with
options.

Best regards
Dariusz Wojtas

On 12/28/06, Musachy Barroso <mbarroso@(protected):
> Hi Dariusz
>
> I need to update the documentation with this info, the thing is that for
> each autocompleter, struts will create 2 fields, one for the text
> entered, with the name "${name}" and another for the key, with the name
> "${name}Key", we need both to "remember" the values if there is a
> validation error or you return INPUT from your page, so if you have:
>
> ["ACURA","351"]
>
> and
>
> <s:autocompleter name="car"....>
>
> when you click submit, it will submit:
>
>  car=ACURA&carKey=351
>
> you need to add the property "car" and "carKey" in your action. About
> the opera problem, I haven't test it on opera, but I will check it out.
>
> regards
> musachy

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

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