<div class="buttons">
<button id="Recommend" disabled><img src="/images/recommend.png" alt=""/>Recommend</button>
<button id="Consume"><img src="/images/winesmall.png" alt=""/>Consume</button>
<form data-lift="form.ajax">
<div data-lift="Cancel?form=post">
<button name="Cancel"></button>
</div>
</form>
</div>
</div> <!-- end of higher level div-->
</form> <!-- end of higher level form -->
object Cancel {
def render =
"@Cancel" #> SHtml.ajaxButton("Cancel", () => {
ProductSelectionCache.product.set(None) // clear out data using a SessionVar Box.
RedirectTo("/index")
}) &
"@Cancel -*" #> <img alt="" src="/images/cancel.png"></img> // make sure to add content with image
}
I am trying to layout three buttons together horizontally on same page, but 3rd button (Cancel, always enabled) shows up on next row because of divs with one of the first two buttons always disabled. I am nesting 2 lift forms below. Is nesting two forms in html legitimate or not?
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to a topic in the Google Groups "Lift" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/liftweb/JWNT6J0A2_M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nested forms do not conform to HTML5 but browsers are pretty good at handling non-conforming HTML and making it work somehow. It will probably work flawlessly 60% of the time. Personally, I would try to avoid it.
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to liftweb+unsubscribe@googlegroups.com.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to liftweb+u...@googlegroups.com.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
"* [onclick]" #> SHtml.ajaxCall(JsRaw("this.id"), { (s: String) =>
s match {
case "consume" => consume()
case "recommend" => recommend()
case "cancel" => cancel()
case _ => Noop
}
// applies to 3 buttons in a span"* [onclick]" #> SHtml.ajaxCall(JsRaw("this.value"), { (s: String) => ... test s in match and call appropriate JsCmd callback at end of which some JS gets executed to update browser elements.
Consider this inquiry as closed. Thanks for the good teaching.
First questions about images as choices for radio are generally answered on web using CSS/CSS3 techniques such as at stackoverflow.com, well outside of lift's scope.
To unsubscribe from this group and all its topics, send an email to liftweb+unsubscribe@googlegroups.com.
def prodAttributesJS(p: Product) = {
val nodeSeq = for (x <- p.createProductLIElemVals) yield <li>{x}</li>
SetHtml("prodAttributes", nodeSeq)
}
So I have quite a few vals/defs that are JsCmds and I combine them with & at end of callback and it works well on the surface of things, in fact I was surprised how easy it was to use. I did see some scary/nefarious Unmapped Lift-like parameter seen in request [/]: F1248216611878RCLVMO you are familiar with when reverting from comets to snippets and indeed the actions don't get triggered (it seems to be related to combining distinct users logging in/out in same browser and users somehow jumping from one tab to the other tab, but I think I have some issues to look at in my JS commands; I have no reason to believe it's any issue with lift itself as I didn't start investigation). Some classic easy-lift reference (not dpp one but a collective of 3 guys) says not to abuse JsCmds/JsExps abstraction (JavaScript generated on server side) and instead use JE.Call to some code on browser. I suppose that they are suggesting that JavaScript interpreter for natural native code in browser is more efficient or simpler than using Lift's abstraction for JS.
Antonio
To unsubscribe from this group and all its topics, send an email to liftweb+u...@googlegroups.com.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to a topic in the Google Groups "Lift" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/liftweb/JWNT6J0A2_M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to liftweb+u...@googlegroups.com.
case class RadioElements(name: String, img: NodeSeq) {}
object LabelStyle {
def htmlize(item: ChoiceItem[RadioElements]): NodeSeq = {
val ns: NodeSeq = item.xhtml ++ item.key.img
<label class="radio">
{ns}{item.key.name}
</label>
}
def toForm(holder: ChoiceHolder[RadioElements]): NodeSeq = {
holder.items.flatMap(htmlize)
}
}
End of snippet's render method uses above as follows:
".options" #> LabelStyle.toForm(SHtml.ajaxRadio(
RadioElements("recommend", <img src="/images/recommend.png" alt="recommend: question mark"/>) ::
RadioElements("consume", <img src="/images/winesmall.png" alt="consume: glass of wine"/>) ::
RadioElements("cancel", <img src="/images/cancel.png" alt="cancel: X"/>) ::
Nil,
Full(RadioElements(theRecommendRadioItem.is, <p></p>)), // the <p></p> is a hack.
(s: RadioElements) => {
s.name match {
case "consume" =>
theRecommendRadioItem.set(s.name)
consume()
case "recommend" =>
theRecommendRadioItem.set(s.name)
recommend()
case "cancel" => cancel()
case _ => Noop // for safety
}
})) andThen
"input [hidden]" #> "true" // to hide the classic circle of the radio button (needs to be scheduled after prior NodeSeq transformation