I tried to use setValueObject, but nothing is working.. what should be the
argument  ?? and Option... a String. ??


On Fri, May 17, 2013 at 8:57 AM, Bob Schellink <[email protected]> wrote:

>  Hi,
>
> Use this:
>
> http://click.apache.org/docs/click-api/org/apache/click/control/Form.html#copyFrom%28java.lang.Object%29
>
> or:
>
> http://click.apache.org/docs/click-api/org/apache/click/control/Field.html#setValueObject%28java.lang.Object%29
>
> regards
>
> Bob
>
>
> On 2013/05/16 20:31, Kristian Lind wrote:
>
> Hi, I have a select where a user can select an option.
>
>  // Select exception
> exception = new Select("exception", true);
> exception.setMultiple(false);
> exception.setDataProvider(new DataProvider() {
>  public List<Option> getData() {
>  List<Option> options = new ArrayList<Option>();
>  List<PrintProviderErrorMockEnt> allErrors = new
> ArrayList<PrintProviderErrorMockEnt>();
>  try {
>  allErrors = printProviderMockSBBeanLocal.getErrors();
>  for (Iterator iterator = allErrors.iterator(); iterator.hasNext();) {
>  PrintProviderErrorMockEnt printProviderErrorMockEnt =
> (PrintProviderErrorMockEnt) iterator.next();
>  options.add(new Option(printProviderErrorMockEnt.getId(),
> printProviderErrorMockEnt.getErrorCode() + " : "
>  + printProviderErrorMockEnt.getName()));
>  }
>  } catch (SystemException e) {
>  // TODO show errorpage
>  logger.error(e.getMessage(), e);
>  }
>  return options;
>  }
> });
> exception.setDefaultOption(Option.EMPTY_OPTION);
>
>
>  When the user has selected a value and presses the submit button the
> value is stored in database.
> This same page is used when the user wants to edit the values....
>
>  How do I set the select control, to have the option selected, that the
> user did select previous when the wants the edit it...
>
>  Kris
>
>
>


-- 
Best regards

Kristian Lind

Reply via email to