Hi wickers  !!

I've a problem with a form and a hidden field.
The form has a CompoundPropertyModel of a data class. This class has an enum 
propertiy, which I want to store into a HiddenField and later retrieve (with 
the whole data class and the rest of the data).

When the panel is rendered, the hidden field gets the correct value - the enum 
name() (or toString()? ) value.
But when I retrieve the form, with the AjaxSubmitLink, I get this error in the 
feedback messagges

    DEBUG - FeedbackMessages           - Adding feedback message 
'[FeedbackMessage message = "The value of 'myType' is not a valid MyType.", 
reporter = myType, level = ERROR]'


Any ideas ?

Thanks a lot

 

    > > > Oscar Besga Arcauz  < < < 


EXAMPLE CODE


//Enumerated
public enum MyType { myTypeOne, myTypeTwo, andSoOn }

// Data class
public class MyData implements Serializable {   
        MyType myType;
}

//Panel with form
public class MyPanel extends Panel {

    public MyPanel(String id) {
        super(id);
                MyData data = new MyData();
                data.myType = MyType.myTypeTwo;
        Form<MyData> form = new Form<MyData>("form",new 
CompoundPropertyModel<MyData>(data));
                form.add(new HiddenField("myType"); //data
        AjaxSubmitLink submit = new AjaxSubmitLink("Submit"){

            @Override
            protected void onError(AjaxRequestTarget target, Form<?> form) {
                //ALWAYS GETS ME AN ERROR !!! 
                                super.onError(target,form);
            }

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                super.onSubmit(target, form);
            }
        };              
    }

}


    > > > Oscar Besga Arcauz  < < < 
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to