On this page, we'll allow the user to select a series of <div> tags to display based on the results of a form submission.
The code to store the state of the div tags is:
private var whichDivs: Array[Boolean] = Array(true, true, true, true, true, true)And to select the div tags:
def selectDivs(in: NodeSeq): NodeSeq = { def calcNum(in: String): Box[Int] = if (in.startsWith("num_")) asInt(in.substring(4)) else Empty for { div <- in \\ "div" // select the div tags id = (div \ "@id").text // get their id num <- calcNum(id) if whichDivs(num) // filter } yield div }