scala lift, remove locale and time zone from Sign Up

84 views
Skip to first unread message

Sanx

unread,
Nov 17, 2010, 6:11:22 PM11/17/10
to Lift
Greetings

I have the following code:

package net_alchim31_vscaladoc2_www.model

import java.util.Locale
import java.util.Properties
import net.tanesha.recaptcha.ReCaptchaImpl
import net.tanesha.recaptcha.ReCaptchaFactory
import scala.xml.XML
import net.liftweb.http.S
import net.liftweb.util.FieldError
import net.liftweb.mapper.MappedPostalCode
import net.liftweb.mapper.MappedCountry
import net.liftweb.mapper.MappedTextarea
import net.liftweb.mapper.MegaProtoUser
import net.liftweb.mapper.MetaMegaProtoUser
import net.liftweb.common.{Box, Full, Empty, Failure}

/*
import _root_.net.liftweb.mapper._
import _root_.net.liftweb.util._
import _root_.net.liftweb.common._
*/
// TODO : Captcha integration (ReCaptcha)
// * http://groups.google.com/group/liftweb/browse_thread/thread/6188f67398414268/606b0480d7dde507?lnk=gst&q=recaptcha#606b0480d7dde507
// * http://code.google.com/apis/recaptcha/docs/java.html
// * reCaptcha info for alchim31 https://www.google.com/recaptcha/admin/site?siteid=314371730

// TODO : GeoLocalisation of JdR player
// * http://code.google.com/apis/maps/documentation/geocoding/

/**
* The singleton that has methods for accessing the database
*/
object User extends User with MetaMegaProtoUser[User] with ReCaptcha {
override def dbTableName = "users" // define the DB table name
override def screenWrap = Full(<lift:surround with="default"
at="content">
<lift:bind/>
</lift:surround>)
override def signupFields = fieldOrder //TODO append captcha

// define the order fields will appear in forms and output
//override def fieldOrder = List(firstName, lastName, email, locale,
timezone, password)
override def fieldOrder = List(firstName, lastName, email, password)

// TODO comment this line out to require email validations
override def skipEmailValidation = true

override def validateSignup(user: User): List[FieldError] =
validateCaptcha() ::: super.validateSignup(user)
override def signupXhtml(user: User) = {
(<form method="post" action={ S.uri }>
<table>
<tr><td colspan="2">{ S.??("sign.up") }</td></tr>
{ localForm(user, false) }
<tr><td>&nbsp;</td><td>{ captchaXhtml() }</td></tr>
<tr><td>&nbsp;</td><td><user:submit/></td></tr>
</table>
</form>)
}

}

/**
* An O-R mapped "User" class that includes first name, last name,
password and we add a "Personal Essay" to it
*/
class User extends MegaProtoUser[User] {
def getSingleton = User // what's the "meta" server

// object country extends MappedCountry(this) {
// override def defaultValue =
S.containerRequest.flatMap(_.locale).getOrElse(Locale.getDefault).getDisplayCountry
// }
// object postalCode extends MappedPostalCode(this, this.country)

}

from: https://github.com/davidB/vscaladoc2_www/blob/master/src/main/scala/net_alchim31_vscaladoc2_www/model/User.scala

I want to remove the locale and time zone fields with:

override def fieldOrder = List(firstName, lastName, email, password)

but nothing happens

not that I'm doing wrong

can someone help me please

David Pollak

unread,
Nov 17, 2010, 6:22:36 PM11/17/10
to lif...@googlegroups.com
I created a clean Lift 2.2-M1 project, changed:


  override def signupFields = List(firstName, lastName, email, password)

in User.scala

And those were the only fields displayed on the signup screen.

Can you show a reproducible example of the problem?


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

Sanx

unread,
Nov 18, 2010, 7:26:19 PM11/18/10
to Lift
thank you very much!!!

you're right

I have only a small change

The following line of code:

{ localForm(user, false) }

is replaced by:

{ localForm(user, false, fieldOrder) }

and with this change, everything works fine!!!

eeeaaaaa!!!
> >http://groups.google.com/group/liftweb/browse_thread/thread/6188f6739...
> > // *http://code.google.com/apis/recaptcha/docs/java.html
> > // * reCaptcha info for alchim31
> >https://www.google.com/recaptcha/admin/site?siteid=314371730
>
> > // TODO : GeoLocalisation of JdR player
> > // *http://code.google.com/apis/maps/documentation/geocoding/
> >https://github.com/davidB/vscaladoc2_www/blob/master/src/main/scala/n...
>
> > I want to remove the locale and time zone fields with:
>
> > override def fieldOrder = List(firstName, lastName, email, password)
>
> > but nothing happens
>
> > not that I'm doing wrong
>
> > can someone help me please
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
Reply all
Reply to author
Forward
0 new messages