[Lift] Re: Box and bind

2009-09-08 Thread Naftoli Gugenheim
There should be implicits that allow you to bind to a Box of a NodeSeq, so you can bind to prodBox.map(_.toForm). Otherwise bind to prodBox.map(_.toForm).openOr(NodeSeq.Empty) etc. - José Maríajosemariar...@gmail.com wrote: Hi. Boxes are giving me a hard

[Lift] Re: Box and bind

2009-09-08 Thread Ross Mellgren
Well it depends on precisely what you want. If you want your snippet to become empty if the product is not there, try: productBox.map(product = { bind(product, ns, ...) }).openOr(NodeSeq.Empty) If you want only certain bind positions empty, do the same thing inside the bind:

[Lift] Re: Box and bind

2009-09-08 Thread José María
That's my code: val product = Product.find(id) producto.map(product = bind(product, xhtml, url_enlace -- /product/ + product.id.toString , ) ).openOr(NodeSeq.Empty) } and I get this error: [INFO] use java command with args in file forced

[Lift] Re: Box and bind

2009-09-08 Thread Ross Mellgren
Because the compiler interpret your expression as you expect. Instead of: url_enlace - (/product/ + product.id.toString) which is what you wanted, it got: (url_enlace - /product/) + product.id.toString) which it can do because it can take an arbitrary object: (url_enlace - /product/):

[Lift] Re: Box and bind

2009-09-08 Thread Naftoli Gugenheim
Operators starting with - and + have the same precendence so they are combined left to right. Thus you are concatenating a BindParam with a String, returning a String. - José Maríajosemariar...@gmail.com wrote: It worked when I put the () around the bind

[Lift] Re: Box and bind

2009-09-08 Thread Naftoli Gugenheim
Precedence is determined by the first character of an operator. - Ross Mellgrendri...@gmail.com wrote: Because the compiler interpret your expression as you expect. Instead of: url_enlace - (/product/ + product.id.toString) which is what you wanted, it

[Lift] Re: Box and bind

2009-09-08 Thread Naftoli Gugenheim
Yup - José Maríajosemariar...@gmail.com wrote: OMG So, as - begins with - then it has the precedence of the operator - On Sep 8, 7:52 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Precedence is determined by the first character of an operator.

[Lift] Re: Box and bind

2009-09-08 Thread José María
It worked when I put the () around the bind param and the question is ... why? On Sep 8, 7:35 pm, Ross Mellgren dri...@gmail.com wrote: So that doesn't seem to be a box-related thing so much as a bind   argument related thing, probably because you have a precedence   problem... try:

[Lift] Re: Box and bind

2009-09-08 Thread José María
I adapted the code but not the error, Producto is Product in Spanish. On Sep 8, 7:35 pm, Ross Mellgren dri...@gmail.com wrote: So that doesn't seem to be a box-related thing so much as a bind   argument related thing, probably because you have a precedence   problem... try:

[Lift] Re: Box and bind

2009-09-08 Thread José María
OMG So, as - begins with - then it has the precedence of the operator - On Sep 8, 7:52 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Precedence is determined by the first character of an operator. - Ross Mellgrendri...@gmail.com wrote:

[Lift] Re: Box and bind

2009-09-08 Thread Ross Mellgren
So that doesn't seem to be a box-related thing so much as a bind argument related thing, probably because you have a precedence problem... try: producto.map(product = bind(product, xhtml, url_enlace - (/product/ + product.id.toString), ) ).openOr(NodeSeq.Empty) Also, FYI,