Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix the field() method in LiftScreen that uses an underlying field so it... #1404

Closed
wants to merge 1 commit into from

2 participants

@cgaudreau

... incorporates passes in validations as well as the validations on the underlying field. Previously, validations passed were ignored:

val username = field(User.username, valMinLen(2, "Your username is too short. Please go die (or make it longer)."))

Now they aren't ignored.

https://groups.google.com/forum/?fromgroups=#!topic/liftweb/QceKSZ2_WIA

@cgaudreau cgaudreau Fix the field() method in LiftScreen that uses an underlying field so…
… it incorporates passes in validations as well as the validations on the underlying field.
1e76b11
@fmpwizard
Owner

rebasing to master in less than an hour

@fmpwizard
Owner

rebased to master

Thanks for the pull request!

@fmpwizard fmpwizard closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2013
  1. @cgaudreau

    Fix the field() method in LiftScreen that uses an underlying field so…

    cgaudreau authored
    … it incorporates passes in validations as well as the validations on the underlying field.
This page is out of date. Refresh to see the latest.
View
6 contributors.md
@@ -120,3 +120,9 @@ Gregory Flanagan
### Email: ###
gregmflanagan at gmail dot com
+
+### Name: ###
+Chris Gaudreau
+
+### Email: ###
+webmaster at crystala dot net
View
14 web/webkit/src/main/scala/net/liftweb/http/LiftScreen.scala
@@ -477,13 +477,11 @@ trait AbstractScreen extends Factory {
override def helpAsHtml = newHelp or underlying.helpAsHtml
- override def validate: List[FieldError] = underlying.validate
+ override def validate = underlying.validate ::: super.validate
- /*
override def validations = stuff.collect {
- case AVal(f) => f
- }.toList ::: underlying.validations
- */
+ case AVal(f) => f.asInstanceOf[ValueType => List[FieldError]]
+ }.toList
override def setFilter = stuff.collect {
case AFilter(f) => f
@@ -581,7 +579,11 @@ trait AbstractScreen extends Factory {
override def helpAsHtml = newHelp or underlying.flatMap(_.helpAsHtml)
- override def validate: List[FieldError] = underlying.toList.flatMap(_.validate)
+ override def validate = underlying.toList.flatMap(_.validate) ::: super.validate
+
+ override def validations = stuff.collect {
+ case AVal(f) => f.asInstanceOf[ValueType => List[FieldError]]
+ }.toList
override def setFilter = stuff.collect {
case AFilter(f) => f
Something went wrong with that request. Please try again.