|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
editable formReply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message I am trying to create an editable form - this has a drop down list. in it List ratingList = cfg.getContentRatingList(); DropDownChoice ratingChoice = new DropDownChoice("rating", new PropertyModel(form, "category"), ratingList, new ChoiceRenderer("label", "id")); ratingChoice.setRequired(true); add(ratingChoice); ratingList is a list of object types of the following class. public class ConfigContent implements Serializable{ private String label; private String id; public ConfigContent(String id, String label){ this.label = label; this.id = id; } public String getLabel(){ return this.label; } public String getId(){ return this.id; } public void setLabel( String label){ this.label = label; } public void setId( String Id){ this.id = Id; } } private class FormData implements Serializable{ private String m_name; private String m_siteUrl; private String m_rating; public String getName() { return this.m_title; } public String getSiteUrl() { return this.m_SiteUrl; } public String getRating() { return this.m_rating; } .... setter methods. } } The html seems to be getting rendered properly - <select wicket:id="rating" name="rating"><option selected="selected" value="">Choose One</option><option value="0">PG</option><option value="1">PG-13</option> <option value="2">PG-17</option><option value="3">Restricted</option></select> But when i submit the form and print out the values beign returned to me - public void onSubmit(){ Log log = LogFactory.getLog(PublishForm.class); FormData mod = (PublishFormModel)getModelObject(); String title = mod.getTitle(); String feedUrl = mod.getSiteUrl(); String rating = mod.getRating(); the values for the dropdown are not right - I end up getting - category:com.test.ConfigContent@1f3834 And then an error is returned to the web page - ERROR [http-8080-1] (WebRequestCycle.java:200) - No get method defined for class: class java.lang.String expression: id wicket.WicketRuntimeException: No get method defined for class: class java.lang.String expression: id at wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:324) at wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:200) at wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:88) at wicket.markup.html.form.ChoiceRenderer.getIdValue(ChoiceRenderer.java:148) would appreciate pointers thx, ed _________________________________________________________________ Missed the show? Watch videos of the Live Earth Concert on MSN. http://liveearth.msn.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions. _______________________________________________ Wicket-user mailing list Wicket-user@... https://lists.sourceforge.net/lists/listinfo/wicket-user |
|
|
Re: editable form
by Gabor Szokoli
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message Hi,
On 7/29/07, Ed _ <ed_b_71@...> wrote: > > I am trying to create an editable form - this has a drop down list. in it > > List ratingList = cfg.getContentRatingList(); > DropDownChoice ratingChoice = new DropDownChoice("rating", new > PropertyModel(form, "category"), ratingList, new > ChoiceRenderer("label", "id")); I think what happens here is form.setCategory(ratingList.get(chosenOne)). That's why you see generic toString output as the assigned value. As a simple hack, you could override the toString() method of the rating class. For a semi-decent solution, override the convertValue method of DropDownChoice. I think what you really need is to add a Converter to ratingChoice. (but IConverter does not extend IBehavior, so I don't know how to do that properly) And in an unrelated note, you could call this component "category" instead of "rating", and give a CompoundProertyModel to the form. Saves a lot of typing in the long run, ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ IMPORTANT NOTICE: This mailing list is shutting down. Please subscribe to the Apache Wicket user list. Send a message to: "users-subscribe at wicket.apache.org" and follow the instructions. _______________________________________________ Wicket-user mailing list Wicket-user@... https://lists.sourceforge.net/lists/listinfo/wicket-user |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |