h**d 发帖数: 474 | 1 any suggestion for a good approach? would like to have an elegant way to
implement this,
since this will be the requirement for all the fields across the whole
project.
tools are used:
Waffle as web framework, validation is done in controller(action),
and validation messages are exposed in ${errors},
JSP and DOJO are used.
Business requirement:
when field validation fails, change the label to red, and display the error
message with the field
thanks. | g*****g 发帖数: 34805 | 2 Not familiar with Waffle, but most frameworks have a concept
of validator. e.g. Spring MVC has a validator interface that
has these two functions.
public boolean supports(Class givenClass)
public void validate(Object obj, Errors errors)
The first function specify the type of form bean,
the second one processes the form bean and append errors.
Then you can have a custom jsp tag to do view if the framework
doesn't already have one.
error
【在 h**d 的大作中提到】 : any suggestion for a good approach? would like to have an elegant way to : implement this, : since this will be the requirement for all the fields across the whole : project. : tools are used: : Waffle as web framework, validation is done in controller(action), : and validation messages are exposed in ${errors}, : JSP and DOJO are used. : Business requirement: : when field validation fails, change the label to red, and display the error
| h**d 发帖数: 474 | 3 Thanks for the suggestion.
I don't have any problem from the server side, web framework does not really
matter.
In my case, after the validation, all the validation errors will be exposed
in ${errors},
need to have a good way of linking the specific error to the field(maybe use
custom tag?),
and change the label for that field to a different color.
I have not tried custom tag yet, since it needs to change the label color,
and append error message to the field. Also it needs to handle all possibl
【在 g*****g 的大作中提到】 : Not familiar with Waffle, but most frameworks have a concept : of validator. e.g. Spring MVC has a validator interface that : has these two functions. : public boolean supports(Class givenClass) : public void validate(Object obj, Errors errors) : The first function specify the type of form bean, : the second one processes the form bean and append errors. : Then you can have a custom jsp tag to do view if the framework : doesn't already have one. :
| s******e 发帖数: 493 | 4 Even I do not think that you should use innerhtml, it should be doable.
If I were you, I would first check waffle doc to see if it has some built-in
tags. If there is none, you might want to email the guy who found the
waffle. Never used waffle before, but several years ago had a quick look at
the project. The guy should be from thoughtworks. I am not sure if he is
still with them.
For me, innerhtml should be used in xmlhttprequest(ajax) for partial refresh
or some client side only action such | h**d 发帖数: 474 | 5 agreed...
Mike ward is one of my best friends...unfortunately, waffle does not provide
good tags to let you select where to display error messages:(
I was not the one who chose waffle, the person who chose the framework left
the project:( Actually I like waffle a lot, but I would not suggest it for
professional projects, since it does not have strong community. Lack of tag
support is another issue.
in
at
refresh
【在 s******e 的大作中提到】 : Even I do not think that you should use innerhtml, it should be doable. : If I were you, I would first check waffle doc to see if it has some built-in : tags. If there is none, you might want to email the guy who found the : waffle. Never used waffle before, but several years ago had a quick look at : the project. The guy should be from thoughtworks. I am not sure if he is : still with them. : For me, innerhtml should be used in xmlhttprequest(ajax) for partial refresh : or some client side only action such
|
|