zhoupan / jmesa

Automatically exported from code.google.com/p/jmesa
0 stars 0 forks source link

Validation Help #292

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello Jeff. I wanna do some min, max validation on my jmesa table. I do the 
next thing.

worksheetValidation="required:true;min:${bean.minValue };max:${bean.maxValue }"

I wanna do min-max validation based coming from the bean on the collection. The 
problem is that the values are always the same (the values of the first bean of 
the collection) . Is there something i can do¿?

Thanks!

Original issue reported on code.google.com by VictorRo...@gmail.com on 14 Oct 2010 at 12:42

GoogleCodeExporter commented 9 years ago
No, that would not be possible. The JavaScript is made up for the column just 
once. The validation framework that JMesa uses supports it (with a callback) 
but that functionality is not exposed. I am not sure it would work (on a table) 
even if we somehow could expose it.

Original comment by jeff.johnston.mn@gmail.com on 18 Oct 2010 at 9:36

GoogleCodeExporter commented 9 years ago
You could do the validation on the server side...

Original comment by jeff.johnston.mn@gmail.com on 18 Oct 2010 at 9:36

GoogleCodeExporter commented 9 years ago
Hi jeff. Yes, thats what i thoug, to do the validation on the server side, but 
how can i get the min and max value of the columns of the server side if they 
are not part of the worksheet?

Original comment by VictorRo...@gmail.com on 19 Oct 2010 at 6:52

GoogleCodeExporter commented 9 years ago
You would have to use the WorksheetRow uniqueProperty value and go query a 
service in your code to find the bean (item).

The worksheet only holds the changes made and gives you a way to associate the 
row back to the original object via the uniqueProperty value. As we have worked 
with the worksheet more at my company we have found cases that we wished we had 
more information about the row. But it is a balance between having too much 
information in session and not enough.

Did you see how you can set errors back on the worksheet column?

Overall I am always looking for input about the worksheet. Compared to the 
other features in JMesa the worksheet is relatively new. If you think of ways 
that it could be better and are willing to experiment with the code we could 
talk about what it would mean to do something else, or at least make some 
features more plugable.

One thing I am on the fence about is the client side validation. On one hand I 
like the way it is implemented, but on the other it might just be easier to 
work with on the server. But I figure we can try it out for awhile and if need 
be we could keep the method calls the same but flip a flag to say do this on 
the server. That way people can use client or server side validation with the 
same syntax.

Original comment by jeff.johnston.mn@gmail.com on 19 Oct 2010 at 3:54

GoogleCodeExporter commented 9 years ago
Not sure if we still have an issue...will close for now.

Original comment by jeff.johnston.mn@gmail.com on 9 Mar 2011 at 8:46

GoogleCodeExporter commented 9 years ago

Original comment by jeff.johnston.mn@gmail.com on 9 Mar 2011 at 8:46