[Lift] Re: Customizing generated form elements without touching scala code

2010-03-05 Thread Marius
I disagree with the unglyness you are talking about just because
Snipets are UI elements. However you can preserve the attributes from
the markup such as:

def doit(xhtml: NodeSeq): NodeSeq = {

  bind(f, xhtml,
text -% SHtml.text(name, println _)
  )

}


and in the markup


lift:MySnippet.doit
   f:text class=abc size=3/
/lift:MySnippet.doit


On Mar 5, 2:07 pm, Julian Backes julianbac...@googlemail.com wrote:
 Hi,

 I'm trying to get my first form in Lift running and I'm having the
 following problem:

 I use for example SHtml.text(..) to create a text input element.
 Unfortunately, this element has no specific class or id such that I can
 customize it using CSS or whatever.

 I know that I can add some parameters to SHtml.text(..) which are passed
 to the generated form element but this means that I have style
 information in my scala code. And this is, in my opinion, very ugly.

 Is there a better solution?

 I could imagine something like e:myfield class=somecssclass/. This
 class information is accessible in scala so the form generator could
 automatically add it to the generated element...

 Thanks in advance for your help!!

 Julian

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



Re: [Lift] Re: Customizing generated form elements without touching scala code

2010-03-05 Thread Julian Backes
Thank you for your answer, also thanks to Jeppe who posted the same 
solution.


 I disagree with the unglyness you are talking about just because
 Snipets are UI elements.
I already read that and although I don't want to start a discussion on 
this, I want to share my opinion with you:
I already read in some blog entries and also here on the mailing list 
that lift completely avoids the problem of having business logic in your 
views/templates.
I think in general, this is a very good idea. On the other hand, many 
people say snippets are part of the view. In almost all examples I 
found, you can see business logic in the snippets. Is this really better 
now? I think you are still mixing business logic and UI stuff, just on a 
different level. Of course, you can seperate that but this adds 
unnecessary complexity to an application.
Or am I missing something? I'm still a beginner in the scala/lift 
world... :-)


Julian

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