Return-Path: Delivered-To: apmail-click-dev-archive@www.apache.org Received: (qmail 11871 invoked from network); 29 Dec 2010 11:56:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Dec 2010 11:56:17 -0000 Received: (qmail 3189 invoked by uid 500); 29 Dec 2010 11:56:17 -0000 Delivered-To: apmail-click-dev-archive@click.apache.org Received: (qmail 3129 invoked by uid 500); 29 Dec 2010 11:56:15 -0000 Mailing-List: contact dev-help@click.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@click.apache.org Delivered-To: mailing list dev@click.apache.org Received: (qmail 3121 invoked by uid 99); 29 Dec 2010 11:56:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Dec 2010 11:56:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Dec 2010 11:56:13 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oBTBtpkq011824 for ; Wed, 29 Dec 2010 11:55:51 GMT Message-ID: <5853169.57891293623751562.JavaMail.jira@thor> Date: Wed, 29 Dec 2010 06:55:51 -0500 (EST) From: "Bob Schellink (JIRA)" To: dev@click.apache.org Subject: [jira] Commented: (CLK-744) Select control's setValue is not usable due to insufficient wrapping In-Reply-To: <10865611.57461293621477238.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CLK-744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975765#action_12975765 ] Bob Schellink commented on CLK-744: ----------------------------------- Setting a String value for Select works fine for me. Can you provide a test page showing the issue? > Select control's setValue is not usable due to insufficient wrapping > -------------------------------------------------------------------- > > Key: CLK-744 > URL: https://issues.apache.org/jira/browse/CLK-744 > Project: Click > Issue Type: Bug > Components: core > Affects Versions: 2.3.0-M1, 2.2.0 > Reporter: Sander van Grieken > > When calling setValue on a Select instance, it bombs out while rendering, regardless whether a String or an Option is passed. > Passing an Option instance causes it to be 'toString'-ed as an Object (i.e. 'org.apache.click.control.Option@1c154a3') when retrieving the selected value again. > Passing a String causes it to throw a java.lang.IllegalArgumentException: Select option class not instance of Option or OptionGroup: java.lang.String > at org.apache.click.control.Select.render(Select.java:998) > I have modified the render(HtmlStringBuffer buffer) method in Select.java to additionally check for String instances, and in that case wrap it into an Option, and that works fine. > if (object instanceof String) { > Option option = new Option(object); > option.render(this, buffer); > } else ... > The setValue method should probably be overridden from Field to also support the Option case -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.