Hi Sven!

While I agree that this will solve the problem, it seems more like a workaround 
than an actual solution. The comparison in "isSelected" only fails if there is 
raw data; if there isn't "isSelected(Model<?>)" is called which works just 
fine. So maybe rather than returning "false" immediately if the comparison 
fails the method "isSelected(Model<?>)" could be called?

Thanks,
Alasdair
________________________________________
Von: Sven Meier <[email protected]>
Gesendet: Montag, 9. November 2015 20:30
An: [email protected]
Betreff: Re: Recreating Select Choices produces weird error handling

Hi Alasdair,

see https://issues.apache.org/jira/browse/WICKET-5606

I must admit that the 'fix' isn't easy to find.

Have fun
Sven

On 09.11.2015 19:16, Collinson, Alasdair wrote:
> Hello everyone!
>
>
> I've been experiencing a weird behavior with Wicket (version 6.19.0, though I 
> think it should be the same with a newer version). The problem is this:
>
> When I have a Select (from wicket-extensions) to which I add a SelectOptions 
> which has "recreateOptions" set to true, the method 
> Select#isSelected(SelectOption<?>) will no longer work if there is an error 
> while submitting the form. So for example I have two such Selects, both are 
> required, I only select an option for one of them and submit. The result is, 
> that neither has a selected value.
>
>
> Here's an example of what one of those selects may look like:
>
>
> Select<String> nameSelect = new Select<String>("name", model);
> SelectOptions<String> options = new SelectOptions<String>("options", 
> possibleNamesModel, new IOptionRenderer<String>() {
>      @Override
>      public String getDisplayValue(String object) {
>          if (object == null) {
>              return "Please choose";
>          }
>          return object;
>      }
>
>      @Override
>      public IModel<String> getModel(String value) {
>          return Model.of(value);
>      }
> });
> options.setRecreateChoices(true);
> nameSelect.add(options);
> nameSelect.setRequired(true);
>
>
> Am I missing something here or is this a bug? I've created a QuickStart which 
> I could upload if I were to create a ticket.
>
>
> Thanks,
>
> Alasdair
>
> Alasdair Collinson
> ______________________________
> Senacor Technologies AG
> Joseph-Schumpeter-Allee 1
> 53227 Bonn
>
> T +49 (228) 7636 - 247
> F +49 (228) 7636 - 100
> M +49 (171) 3019 990
>
> [email protected]
> www.senacor.com
>
>
> Senacor Technologies Aktiengesellschaft - Sitz: Schwaig b. Nbg. - Amtsgericht 
> Nbg.- Reg.-Nr.: HRB 23098
> Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender: Mathias 
> J. Lindermeir
>
> Diese E-Mail inklusive Anlagen enth?lt vertrauliche und/oder rechtlich 
> gesch?tzte Informationen. Wenn Sie
> nicht der richtige Adressat sind oder diese E-Mail irrt?mlich erhalten, 
> informieren Sie bitte den  Absender
> und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte 
> Weitergabe dieser  E-Mail ist
> nicht gestattet.
>
> This e-mail including any attachments may contain confidential and/or 
> privileged information. If you are
> not the intended recipient (or have received this e-mail in error) please 
> notify the sender immediately and
> destroy this e-mail. Any unauthorized copying, disclosure or distribution of 
> the materials in this e-mail is
> strictly forbidden.
>


---------------------------------------------------------------------
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