Just a note: I noticed the same problem when I add a blank enumeration. For instance:

public enum ProjectStatus {
   BLANK(""),
   PENDING,
   IN_PROGRESS,
   COMPLETE,
   CANCELED;
private String value; private ProjectStatus() {
       this.value = name();
   }
   private ProjectStatus(String value) {
       this.value = value;
   }
   public String toString() {
       return value;
   }
}

The blank value works as expected in the "Edit Project" scenario, but not in the "New Project" scenario.

Howard M. Lewis Ship (JIRA) wrote:
[ https://issues.apache.org/jira/browse/TAPESTRY-2176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570335#action_12570335 ]
Howard M. Lewis Ship commented on TAPESTRY-2176:
------------------------------------------------

From the stack trace, it looks like things may have worked, and that the submit 
failed because the value passed from the client to the server (the null) was 
then used when generating a URL.

I'll be putting together a test to see how well this is all handled.

Select component cannot store a blank value on the client side and have it 
represent null.
------------------------------------------------------------------------------------------

                Key: TAPESTRY-2176
                URL: https://issues.apache.org/jira/browse/TAPESTRY-2176
            Project: Tapestry
         Issue Type: Bug
         Components: Core Components
   Affects Versions: 5.0.10
        Environment: Windows XP, Eclipse 3.3.1, Hibernate, Jetty
           Reporter: Daniel
           Assignee: Howard M. Lewis Ship

When implementing a select component that is populated with values from a 
database column, which represents a many to one relationship with the 
object/entity represented by the form containing the select component, blank 
values can be added and validated when editing the object/entity, but not when 
creating a new object/entity.
For example, on a form representing a Product entity that contains a select 
component with a list of Manufacturers, it is possible to:
1. have a blank Manufacturer by default
2. edit a Product and select the blank Manufacturer and get the 
validation="required" message when attempting to save
but it is not possible to get the validation message when creating a new 
Product if the blank Manufacturer is selected when saving. Instead the 
following exception (partial) is thrown:
   * org.apache.tapestry.ioc.internal.util.Defense.notBlank(Defense.java:59)
   * 
org.apache.tapestry.internal.TapestryInternalUtils.encodeContext(TapestryInternalUtils.java:519)
   * 
org.apache.tapestry.internal.services.ComponentInvocationImpl.getPath(ComponentInvocationImpl.java:101)
   * 
org.apache.tapestry.internal.services.ComponentInvocationImpl.buildURI(ComponentInvocationImpl.java:60)
   * org.apache.tapestry.internal.services.LinkImpl.buildURI(LinkImpl.java:105)
   * 
org.apache.tapestry.internal.services.LinkImpl.toRedirectURI(LinkImpl.java:120)
   * 
org.apache.tapestry.internal.services.ResponseImpl.sendRedirect(ResponseImpl.java:69)
   * 
org.apache.tapestry.internal.services.ActionRenderResponseGeneratorImpl.generateResponse(ActionRenderResponseGeneratorImpl.java:45)
   * 
org.apache.tapestry.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:66)
   * 
org.apache.tapestry.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
   * org.apache.tapestry.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
   * 
org.apache.tapestry.services.TapestryModule$39.handle(TapestryModule.java:2073)
   * 
org.apache.tapestry.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:131)
   * 
org.apache.tapestry.services.TapestryModule$13.service(TapestryModule.java:911)
   * com.formos.project.services.AppModule$1.service(AppModule.java:134)



--
Daniel Harvey
Software Engineer
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to