Return-Path: Delivered-To: apmail-incubator-click-commits-archive@minotaur.apache.org Received: (qmail 38851 invoked from network); 29 Jun 2009 21:10:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Jun 2009 21:10:49 -0000 Received: (qmail 99519 invoked by uid 500); 29 Jun 2009 21:11:00 -0000 Delivered-To: apmail-incubator-click-commits-archive@incubator.apache.org Received: (qmail 99506 invoked by uid 500); 29 Jun 2009 21:11:00 -0000 Mailing-List: contact click-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: click-dev@incubator.apache.org Delivered-To: mailing list click-commits@incubator.apache.org Received: (qmail 99495 invoked by uid 99); 29 Jun 2009 21:11:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jun 2009 21:11:00 +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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jun 2009 21:10:58 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5B3DB238888D; Mon, 29 Jun 2009 21:10:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r789448 - in /incubator/click/trunk/click/examples: src/org/apache/click/examples/page/form/SearchForm.java webapp/form/search-form.htm Date: Mon, 29 Jun 2009 21:10:38 -0000 To: click-commits@incubator.apache.org From: sabob@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090629211038.5B3DB238888D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sabob Date: Mon Jun 29 21:10:37 2009 New Revision: 789448 URL: http://svn.apache.org/viewvc?rev=789448&view=rev Log: validate ID number Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java incubator/click/trunk/click/examples/webapp/form/search-form.htm Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java?rev=789448&r1=789447&r2=789448&view=diff ============================================================================== --- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java (original) +++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java Mon Jun 29 21:10:37 2009 @@ -30,6 +30,8 @@ import org.apache.click.examples.page.BorderPage; import org.apache.click.examples.service.CustomerService; import org.apache.click.util.Bindable; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; import org.springframework.stereotype.Component; /** @@ -72,7 +74,11 @@ String type = typeSelect.getValue().toLowerCase(); if (type.equals("id")) { - customer = customerService.findCustomerByID(value); + if (NumberUtils.isDigits(value)) { + customer = customerService.findCustomerByID(value); + } else { + textField.setError("ID must be a number"); + } } else if (type.equals("name")) { List list = customerService.getCustomersForName(value); Modified: incubator/click/trunk/click/examples/webapp/form/search-form.htm URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/webapp/form/search-form.htm?rev=789448&r1=789447&r2=789448&view=diff ============================================================================== --- incubator/click/trunk/click/examples/webapp/form/search-form.htm (original) +++ incubator/click/trunk/click/examples/webapp/form/search-form.htm Mon Jun 29 21:10:37 2009 @@ -21,6 +21,12 @@

$form.startTag() + + +#if (!$form.fields.search.valid) +

$form.fields.search.error
+#end + Customer ${form.fields.search}${form.fields.type}${form.fields.go} $form.endTag()