[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Marius

So ... it seems to behave correctly. 'at' and 'with-param' are
mutually exclusive, and 'at' has a higher 'priority' which makes sense
to me.

All in all would be nice if Tyler can put this kind of stuff into the
documentation materials

Br's,
Marius

On Sep 18, 7:16 pm, Tim Perrett <[EMAIL PROTECTED]> wrote:
> They seem to get inserted both within the content bind point.
>
> My default.html looks like:
>
> 
>   
> 
>
> 
>   
> 
>
> Using what you detailed below, neither get inserted if the "at"
> parameter doesnt match anything in the layout. Alterntivly, they both
> get inserted in the "at" element if it matches. The  
> stuff seems to be totally ignored.
>
> I've trawled the wiki but there appear to be no examples
>
> Cheers
>
> Tim
>
> > I think it's:
>
> > 
>
> >   
> > Header stuff
> >   
>
> >   
> > left column stuff
> >   
>
> >   main content stuff
>
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

They seem to get inserted both within the content bind point.

My default.html looks like:


  



  


Using what you detailed below, neither get inserted if the "at"
parameter doesnt match anything in the layout. Alterntivly, they both
get inserted in the "at" element if it matches. The  
stuff seems to be totally ignored.

I've trawled the wiki but there appear to be no examples

Cheers

Tim


> I think it's:
>
> 
>
>   
>     Header stuff
>   
>
>   
>     left column stuff
>   
>
>   main content stuff
>
> 

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread David Pollak
On Thu, Sep 18, 2008 at 7:14 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Ok cool i'll give that a shot
>
> Just whilst were talking about layouts
>
> If I have two insertion points in my default.html
>
> 
> 


I think it's:



  
Header stuff
  

  
left column stuff
  

  main content stuff




>
>
> It appears to be not possible to insert into both elements from a
> page? I've tried a whole bunch of ways in the html page markup, but it
> always crashed out. Is it not possible? I've not needed to do it up
> until now so have never tried... Is there a solution for this?
>
> Cheers
>
> Tim
>
> On Sep 18, 3:02 pm, "David Pollak" <[EMAIL PROTECTED]>
> wrote:
> > On Thu, Sep 18, 2008 at 6:52 AM, Tim Perrett <[EMAIL PROTECTED]>
> wrote:
> >
> > > > Are you running 0.9 or 0.10-SNAPSHOT (not that that should make a
> > > > difference).
> >
> > > Im running the bleeding edge.
> >
> > Weird... please do an rm -rf ~/.m2/repository and do an mvn clean
> jetty:run
> >
> > There should be no Content-Encoding header in the latest 0.10-SNAPSHOT
> >
> >
> >
> > > > Also, the Content-Type is text/html and it should be something else
> that
> > > > indicates xhtml.
> >
> > > Shouldnt XHTML have "Content-type: application/xhtml+xml" ?
> >
> > If the browser sends a header Accepts: ... this is so we don't confuse
> IE.
> >
> >
> >
> > > > What browser are you having a problem with?
> >
> > > Safari, and Firefox (PC only, mac seemed fine) and IE. So pretty much
> > > all of them. I had the following on my body tag in the CSS:
> >
> > > body {
> > >  background:#FF url('/images/bg.gif') repeat scroll 0 0;
> > >  text-align: center;
> > >  color:#766D6A;
> > > }
> >
> > Please do an http request on the server to make sure the CSS is being
> > delivered correctly.  Also, I would recommend against absolute paths in
> CSS.
> >
> >
> >
> > > Which worked perfectly fine across all the aforementioned browsers
> > > when it was not being served with lift (i.e. statically)
> >
> > > Cheers
> >
> > > Tim
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Collaborative Task Managementhttp://much4.us
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

Ok cool i'll give that a shot

Just whilst were talking about layouts

If I have two insertion points in my default.html




It appears to be not possible to insert into both elements from a
page? I've tried a whole bunch of ways in the html page markup, but it
always crashed out. Is it not possible? I've not needed to do it up
until now so have never tried... Is there a solution for this?

Cheers

Tim

On Sep 18, 3:02 pm, "David Pollak" <[EMAIL PROTECTED]>
wrote:
> On Thu, Sep 18, 2008 at 6:52 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:
>
> > > Are you running 0.9 or 0.10-SNAPSHOT (not that that should make a
> > > difference).
>
> > Im running the bleeding edge.
>
> Weird... please do an rm -rf ~/.m2/repository and do an mvn clean jetty:run
>
> There should be no Content-Encoding header in the latest 0.10-SNAPSHOT
>
>
>
> > > Also, the Content-Type is text/html and it should be something else that
> > > indicates xhtml.
>
> > Shouldnt XHTML have "Content-type: application/xhtml+xml" ?
>
> If the browser sends a header Accepts: ... this is so we don't confuse IE.
>
>
>
> > > What browser are you having a problem with?
>
> > Safari, and Firefox (PC only, mac seemed fine) and IE. So pretty much
> > all of them. I had the following on my body tag in the CSS:
>
> > body {
> >  background:#FF url('/images/bg.gif') repeat scroll 0 0;
> >  text-align: center;
> >  color:#766D6A;
> > }
>
> Please do an http request on the server to make sure the CSS is being
> delivered correctly.  Also, I would recommend against absolute paths in CSS.
>
>
>
> > Which worked perfectly fine across all the aforementioned browsers
> > when it was not being served with lift (i.e. statically)
>
> > Cheers
>
> > Tim
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Collaborative Task Managementhttp://much4.us
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread David Pollak
On Thu, Sep 18, 2008 at 6:52 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
>
> > Are you running 0.9 or 0.10-SNAPSHOT (not that that should make a
> > difference).
>
> Im running the bleeding edge.


Weird... please do an rm -rf ~/.m2/repository and do an mvn clean jetty:run

There should be no Content-Encoding header in the latest 0.10-SNAPSHOT


>
>
> > Also, the Content-Type is text/html and it should be something else that
> > indicates xhtml.
>
> Shouldnt XHTML have "Content-type: application/xhtml+xml" ?


If the browser sends a header Accepts: ... this is so we don't confuse IE.


>
>
> > What browser are you having a problem with?
>
> Safari, and Firefox (PC only, mac seemed fine) and IE. So pretty much
> all of them. I had the following on my body tag in the CSS:
>
> body {
>  background:#FF url('/images/bg.gif') repeat scroll 0 0;
>  text-align: center;
>  color:#766D6A;
> }
>

Please do an http request on the server to make sure the CSS is being
delivered correctly.  Also, I would recommend against absolute paths in CSS.


>
> Which worked perfectly fine across all the aforementioned browsers
> when it was not being served with lift (i.e. statically)
>
> Cheers
>
> Tim
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett


> Are you running 0.9 or 0.10-SNAPSHOT (not that that should make a
> difference).

Im running the bleeding edge.

> Also, the Content-Type is text/html and it should be something else that
> indicates xhtml.

Shouldnt XHTML have "Content-type: application/xhtml+xml" ?

> What browser are you having a problem with?

Safari, and Firefox (PC only, mac seemed fine) and IE. So pretty much
all of them. I had the following on my body tag in the CSS:

body {
  background:#FF url('/images/bg.gif') repeat scroll 0 0;
  text-align: center;
  color:#766D6A;
}

Which worked perfectly fine across all the aforementioned browsers
when it was not being served with lift (i.e. statically)

Cheers

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread David Pollak


Tim Perrett wrote:
> timperrett$ curl -I http://127.0.0.1:8080
> HTTP/1.1 200 OK
> Expires: 0
> Set-Cookie: JSESSIONID=1gid6kn3mc11r;Path=/
> Content-Length: 3515
> Content-Encoding: UTF-8
> Content-Type: text/html
> Server: Jetty(6.1.12rc1)
>
> In this particular instance I've managed a work-around with CSS, but
> it would be good to know why it works no problem standalone, but has
> issues when running from jetty.
>   
Are you running 0.9 or 0.10-SNAPSHOT (not that that should make a 
difference).

Also, the Content-Type is text/html and it should be something else that 
indicates xhtml.

What browser are you having a problem with?

> Cheers
>
> Tim
>
> On Sep 18, 2:32 pm, "David Pollak" <[EMAIL PROTECTED]>
> wrote:
>   
>> What are the headers that are being sent to your browser?
>> 
>
>
> >
>   

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

I've also posted this information onto the wiki

http://liftweb.net/index.php/Setting_Template_Doctype


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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

timperrett$ curl -I http://127.0.0.1:8080
HTTP/1.1 200 OK
Expires: 0
Set-Cookie: JSESSIONID=1gid6kn3mc11r;Path=/
Content-Length: 3515
Content-Encoding: UTF-8
Content-Type: text/html
Server: Jetty(6.1.12rc1)

In this particular instance I've managed a work-around with CSS, but
it would be good to know why it works no problem standalone, but has
issues when running from jetty.

Cheers

Tim

On Sep 18, 2:32 pm, "David Pollak" <[EMAIL PROTECTED]>
wrote:
> What are the headers that are being sent to your browser?


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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread David Pollak
What are the headers that are being sent to your browser?

On Thu, Sep 18, 2008 at 6:25 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Interestingly, now the DTD is coming through properly the background
> of my body is all screwy (but in the static html it works fine). When
> the page is being served by Lift the background doesn't show properly,
> but even if i take the html thats its generating and paste it into a
> text file and view it in my browser its fine.
>
> What on earth could be causing this anomaly? Something must be going
> on as the static HTML i've created is fine in the browsers away from
> lift.
>
> Any thoughts?
>
> Cheers
>
> Tim
>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

Interestingly, now the DTD is coming through properly the background
of my body is all screwy (but in the static html it works fine). When
the page is being served by Lift the background doesn't show properly,
but even if i take the html thats its generating and paste it into a
text file and view it in my browser its fine.

What on earth could be causing this anomaly? Something must be going
on as the static HTML i've created is fine in the browsers away from
lift.

Any thoughts?

Cheers

Tim


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



[Lift] Re: bind and enumerations

2008-09-18 Thread David Pollak
Sorry. There was a bug in my code and the type inferencer didn't do its job:

var g: Can[*Gender.Value*] = Empty
selectObj*[Gender.Value]*(Gender.elements.toList.map(v => (v,
v.toString)),
  g,
  v => g = Full(v))

One other this you can do in Gender is:

val selectList = elements.toList.map(v => (v, v.toString)

And in your selectObj, you can replace Gender.elements.toList.map(v => (v,
v.toString)) with Gender.selectList




On Thu, Sep 18, 2008 at 12:33 AM, Charles F. Munat <[EMAIL PROTECTED]> wrote:

>
> def add (xhtml : NodeSeq) : NodeSeq = {
>   def doAdd () = {
> Model.em.merge(user)
> redirectTo("index")
>   }
>
>   val currentId = user.id
>
>   var g: Can[Gender] = Empty
>
>bind( "user", xhtml,
> "id" -> SHtml.hidden({user.id = currentId}),
> "nameLast" -> SHtml.text(user.nameLast, user.nameLast = _),
> "nameFirst" -> SHtml.text(user.nameFirst, user.nameFirst = _),
> "username" -> SHtml.text(user.username, user.username = _),
>  "gender" -> SHtml.selectObj(Gender.elements.toList.map(
>v => (v, v.toString)), g, v => g = Full(v)),
>  "save" -> SHtml.submit(?("Save"), doAdd)
>   )
> }
>
>
>
> David Pollak wrote:
> > Please post the part of the code where you define the "g" var.
> >
> > On Wed, Sep 17, 2008 at 9:45 PM, Charles F. Munat <[EMAIL PROTECTED]
> > > wrote:
> >
> >
> > And it gives me:
> >
> >  error: missing parameter type
> > "gender" -> SHtml.selectObj(Gender.elements.toList.map(v => (v,
> > v.toString)), g, v => g = Full(v)),
> >  ^
> >
> > :-(
> >
> > Oliver wrote:
> >  > When I saw this answer, I was really hoping it would work.
> >  > Unfortunately,
> >  > Gender.elements.toList.map(v => (v, v.toString))
> >  > gives me
> >  > List((a.Gender(0),a.Gender(0)), (a.Gender(1),a.Gender(1)))
> >  >
> >  > On Thu, Sep 18, 2008 at 12:56 PM, David Pollak
> >  > <[EMAIL PROTECTED]
> > 
> >  > >>
> >  > wrote:
> >  >
> >  > var g: Can[Gender] = Empty
> >  >
> >  > SHtml.selectObj(Gender.elements.toList.map(v => (v,
> > v.toString)), g,
> >  > v => g = Full(v))
> >  >
> >  >
> >  >
> >  > On Wed, Sep 17, 2008 at 7:33 PM, Charles F. Munat
> > <[EMAIL PROTECTED] 
> >  > >> wrote:
> >  >
> >  >
> >  > I'm using an enumeration for Gender:
> >  >
> >  > @serializable
> >  > object Gender extends Enumeration {
> >  >   type Gender = Value
> >  >   val Male, Female = Value
> >  > }
> >  >
> >  > import Gender._
> >  >
> >  > How do I use this in bind? And is there an easy way to
> > create a drop
> >  > down list with blank, Male, and Female options?
> >  >
> >  > Thanks!
> >  >
> >  > Chas.
> >  >
> >  >
> >  >
> >  >
> >  >
> >  > --
> >  > Lift, the simply functional web framework http://liftweb.net
> >  > Collaborative Task Management http://much4.us
> >  > Follow me: http://twitter.com/dpp
> >  > Git some: http://github.com/dpp
> >  >
> >  >
> >  >
> >  >
> >  > >
> >
> >
> >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Collaborative Task Management http://much4.us
> > Follow me: http://twitter.com/dpp
> > Git some: http://github.com/dpp
> >
> > >
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread David Pollak
I like the simultaneous posting mind-meld kinda thing. :-)

On Thu, Sep 18, 2008 at 6:02 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Ah thanks David - sorry about the additional post... we must have
> posted at the same time! Freeky!
>
> I'll document this on the wiki
>
> Cheers
>
> Tim
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

Ah thanks David - sorry about the additional post... we must have
posted at the same time! Freeky!

I'll document this on the wiki

Cheers

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

Ok I found a post going back some time explaining about the doc
types

However Im not sure how to implement it in boot? It appears that the
syntax steve details here:

http://groups.google.com/group/liftweb/browse_thread/thread/7647e3519fbb8e27/82710a148a262361?lnk=gst&q=xhtmlTransitional+#82710a148a262361

That doesnt appear to work?

Cheers

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



[Lift] Re: Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread David Pollak
Tim,

Scala's XML parser ignores the DOCTYPE header.

To fix this, in Boot:

ResponseInfo.docType = {
case _ if S.getDocType._1 => S.getDocType._2
case _ => Full(DocType.xhtmlStrict)
  }

Thanks,

David

On Thu, Sep 18, 2008 at 5:27 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Guys,
>
> I have this DTD in my layout:
>
>  www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> http://www.w3.org/1999/xhtml"; xml:lang="en"
> xmlns:lift="http://liftweb.net/";>
>
> And lift is replacing it with:
>
> 
>  www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> http://liftweb.net/"; xmlns="http://
> www.w3.org/1999/xhtml">
>
> I don't need transitional, my code is fully strict valid. The
> transitional DTD is screwing parts of my layout so I really need to
> use the strict one.
>
> Has anyone seen this before?
>
> Cheers
>
> Tim
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Lift is replacing my Strict DTD with Transitional

2008-09-18 Thread Tim Perrett

Guys,

I have this DTD in my layout:


http://www.w3.org/1999/xhtml"; xml:lang="en"
xmlns:lift="http://liftweb.net/";>

And lift is replacing it with:



http://liftweb.net/"; xmlns="http://
www.w3.org/1999/xhtml">

I don't need transitional, my code is fully strict valid. The
transitional DTD is screwing parts of my layout so I really need to
use the strict one.

Has anyone seen this before?

Cheers

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



[Lift] Re: bind and enumerations

2008-09-18 Thread Charles F. Munat

def add (xhtml : NodeSeq) : NodeSeq = {
   def doAdd () = {
 Model.em.merge(user)
 redirectTo("index")
   }

   val currentId = user.id

   var g: Can[Gender] = Empty

   bind( "user", xhtml,
 "id" -> SHtml.hidden({user.id = currentId}),
 "nameLast" -> SHtml.text(user.nameLast, user.nameLast = _),
 "nameFirst" -> SHtml.text(user.nameFirst, user.nameFirst = _),
 "username" -> SHtml.text(user.username, user.username = _),
 "gender" -> SHtml.selectObj(Gender.elements.toList.map(
v => (v, v.toString)), g, v => g = Full(v)),
 "save" -> SHtml.submit(?("Save"), doAdd)
   )
}



David Pollak wrote:
> Please post the part of the code where you define the "g" var.
> 
> On Wed, Sep 17, 2008 at 9:45 PM, Charles F. Munat <[EMAIL PROTECTED] 
> > wrote:
> 
> 
> And it gives me:
> 
>  error: missing parameter type
> "gender" -> SHtml.selectObj(Gender.elements.toList.map(v => (v,
> v.toString)), g, v => g = Full(v)),
>  ^
> 
> :-(
> 
> Oliver wrote:
>  > When I saw this answer, I was really hoping it would work.
>  > Unfortunately,
>  > Gender.elements.toList.map(v => (v, v.toString))
>  > gives me
>  > List((a.Gender(0),a.Gender(0)), (a.Gender(1),a.Gender(1)))
>  >
>  > On Thu, Sep 18, 2008 at 12:56 PM, David Pollak
>  > <[EMAIL PROTECTED]
> 
>  >>
>  > wrote:
>  >
>  > var g: Can[Gender] = Empty
>  >
>  > SHtml.selectObj(Gender.elements.toList.map(v => (v,
> v.toString)), g,
>  > v => g = Full(v))
>  >
>  >
>  >
>  > On Wed, Sep 17, 2008 at 7:33 PM, Charles F. Munat
> <[EMAIL PROTECTED] 
>  > >> wrote:
>  >
>  >
>  > I'm using an enumeration for Gender:
>  >
>  > @serializable
>  > object Gender extends Enumeration {
>  >   type Gender = Value
>  >   val Male, Female = Value
>  > }
>  >
>  > import Gender._
>  >
>  > How do I use this in bind? And is there an easy way to
> create a drop
>  > down list with blank, Male, and Female options?
>  >
>  > Thanks!
>  >
>  > Chas.
>  >
>  >
>  >
>  >
>  >
>  > --
>  > Lift, the simply functional web framework http://liftweb.net
>  > Collaborative Task Management http://much4.us
>  > Follow me: http://twitter.com/dpp
>  > Git some: http://github.com/dpp
>  >
>  >
>  >
>  >
>  > >
> 
> 
> 
> 
> 
> -- 
> Lift, the simply functional web framework http://liftweb.net
> Collaborative Task Management http://much4.us
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
> 
> > 

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



[Lift] Re: bind and enumerations

2008-09-18 Thread Oliver
Ha that's it - I was hoping they would magically work like java enum's :)

thanks
Ol
On Thu, Sep 18, 2008 at 2:33 PM, David Pollak <[EMAIL PROTECTED]> wrote:

>  It's because you have to create each of the Enumeration's String
> representations manually:
>
> scala> object Gender extends Enumeration {
>  | val Unknown = Value(0, "Unknown")
>  | val Male = Value(1, "Male")
>  | val Female = Value(2, "Female")
>  | }
> defined module Gender
>
> scala> Gender.elements.toList
> res3: List[Gender.Value] = List(Unknown, Male, Female)
>
> scala> Gender.elements.toList.map(v => (v, v.toString))
> res4: List[(Gender.Value, java.lang.String)] = List((Unknown,Unknown),
> (Male,Male), (Female,Female))
>
>
>
> Oliver wrote:
>
> When I saw this answer, I was really hoping it would work.
> Unfortunately,
> Gender.elements.toList.map(v => (v, v.toString))
> gives me
> List((a.Gender(0),a.Gender(0)), (a.Gender(1),a.Gender(1)))
>
> On Thu, Sep 18, 2008 at 12:56 PM, David Pollak <
> [EMAIL PROTECTED]> wrote:
>
>> var g: Can[Gender] = Empty
>>
>> SHtml.selectObj(Gender.elements.toList.map(v => (v, v.toString)), g, v =>
>> g = Full(v))
>>
>>
>> On Wed, Sep 17, 2008 at 7:33 PM, Charles F. Munat <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> I'm using an enumeration for Gender:
>>>
>>> @serializable
>>> object Gender extends Enumeration {
>>>   type Gender = Value
>>>   val Male, Female = Value
>>> }
>>>
>>> import Gender._
>>>
>>> How do I use this in bind? And is there an easy way to create a drop
>>> down list with blank, Male, and Female options?
>>>
>>> Thanks!
>>>
>>> Chas.
>>>
>>>
>>>
>>
>>
>> --
>>  Lift, the simply functional web framework http://liftweb.net
>> Collaborative Task Management http://much4.us
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>
>
>
> >
>

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