list bean properties and empty values

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

list bean properties and empty values

Mike McNally-3
I've got a bean with a list of sub-objects. In general the interactions between the bean and the pages works correctly, except when an entry is empty. In that case, the property binder removes the parameter and it's never cleared.

That is, I've got inputs with names like "whatever[0]", "whatever[1]", "whatever[2]", etc.  When the form posts, and the user has cleared the input for "whatever[1]", then the browser submits correctly with an empty value for that parameter. However, in the routine "validateRequiredFields", the parameter is removed because, well, I'm not sure why.  There's a comment (around line 530 in my 1.5.3 version of the code) in the DefaultActionBeanPropertyBinder that says it wants to remove the parameter so as not to cause validation problems later on.  That breaks things for me - it means that nothing can ever tell that the field should be emptied.

Is that a bug that's been fixed, or am I just doing something wrong?

Turtle, turtle, on the ground,
Pink and shiny, turn around.
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
Stripes-users mailing list
[hidden email]