PDA

View Full Version : Binding Multiple Fields to One Property


lindbird
Jun 7th, 2006, 05:17 PM
Hello,
I am having trouble binding multiple fields from my jsp to one property.

Here is my situation:


<spring:bind path="inquiryCommand.asOfDate">
<input type="text" name="${status.expression}" value="${status.value}"/>
<input type="text" name="${status.expression}" value="${status.value}"/>
<input type="text" name="${status.expression}" value="${status.value}"/>
</spring:bind>

* I have left out the static text to make it shorter

I have created a custom property editor which expects a comma delimited String... which works. But, on the way back out (when my property editor calls getAsText()), I combine the fields back into a comma delimited String (just as it came into setAsText()). My problem is that I don't know how to display each individual field in each input like they came in... the entire comma delimited String is printed in each input.

any thoughts?

thanks,
Ryan

Colin Yates
Jun 8th, 2006, 03:32 AM
You cannot really do this unfortunately :(

Why not just use the (deprecated) methods of date (date.day, date.month, date.year), or write your own Date object?

manifoldronin
Jun 8th, 2006, 11:48 AM
I have created a custom property editor which expects a comma delimited String... which works. But, on the way back out (when my property editor calls getAsText()), I combine the fields back into a comma delimited String (just as it came into setAsText()). My problem is that I don't know how to display each individual field in each input like they came in... the entire comma delimited String is printed in each input.


I might be a little paranoid here - forget about the display problem, to begin with, how can we be sure that the three values in the comma delimited string will always be in the order we expect? In other words, does any user agent have to construct the string in the same order as the fields appear in the page? :)

Colin Yates
Jun 8th, 2006, 12:12 PM
I might be a little paranoid here - forget about the display problem, to begin with, how can we be sure that the three values in the comma delimited string will always be in the order we expect? In other words, does any user agent have to construct the string in the same order as the fields appear in the page? :)
Good question.....

It has been my experience that most browsers *will* be consistent, but there is nothing to say which is first, which is second etc...

I also do not think there is anything in the spec about it...