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.

<div> number visible
This is div 0
This is div 1
This is div 2
This is div 3
This is div 4
This is div 5


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
  }