Is there JsAnd ​​or JsOr when generating JS in the elevator?

I know this is a very important issue ...

I see that the elevator provides utilities for generating javascript commands. I want to make an equivalent:

JsIf((JsEq(ValById("disable-production"),JsTrue) || JsEq(ValById("disable-production"), JsTrue) , { Alert("Do something interesting...") }) 

Thanks.

+1
source share
2 answers

Yes there are :

 import net.liftweb.http.js.JsCmds._ import net.liftweb.http.js.JE._ val conditional = JsIf( JsOr( JsEq(ValById("disable-production"), JsTrue), JsEq(ValById("disable-something-else"), JsTrue) ), Alert("Do something interesting...") ) 
+3
source

You should probably write this directly in string form and then evaluate it using JsExp.strToJValue(<your expression>) .

However, the direct answer to your question would be JE.JsOr .

 JsIf((JE.JsOr(JsEq(ValById("disable-production"),JsTrue), JsEq(ValById("disable-production"), JsTrue)) , { Alert("Do something interesting...") }) 
+1
source

All Articles