stephanrauh / AngularFaces

AngularFaces is a JSF library making it easy to integrate AngularJS code.
https://www.angularfaces.net
Apache License 2.0
90 stars 39 forks source link

enhance <input> elements with HTML5 attributes based on JSR-303 #11

Closed ratcashdev closed 10 years ago

ratcashdev commented 10 years ago

Since AngularFaces can already process JSR-303 annotations and pass these to angular, how about enhancing the tag's attributes with:

stephanrauh commented 10 years ago

Which other attributes might be interesting? The only attribute I can think of is pattern, which is missing indeed. As for the other attributes: I thought I'd already taken care of required, min and max - did I miss a special case? Here's a working example:

@NotNull @Min(1886) @Max(2014) public int getYear() { return car.getYear(); }

image

image

ratcashdev commented 10 years ago

@Size(min=1, max=30, message="{nameMaxLen}") corresponding to <input maxlength="30" /> but as I just figured, there is no minlength attribute in HTML5. the closest solution is using <input pattern=".{1,30}" title="#{msg[nameMaxLen]}"/>

ratcashdev commented 10 years ago

@Required is indeed working. I did not spot this at first, because I had included the attribute manually myself.

stephanrauh commented 10 years ago