0

I have the code below which is supposed to take retrieve a list of strings and return them to an option menu. However, I get an error at the #> after the autocomplete in the snippet that says "could not find implicit value for parameter computer: net.liftweb.util.CanBind[scala.xml.NodeSeq with Int => scala.xml.NodeSeq]"

// The html code
<select id="autoComplete" class="marketplace.pharmacy.list">
  <option id="drug">Drug Name</option>
</select>

// The snippet
def getAutoComplete(str: String): CssSel = "#autoComplete" #> {
  getRxAutoComplete(str) match {
    case list => "select" #> list.map { drug =>
      drug #> ("option *" #> drug)
    }
    case List() => NodeSeq.Empty
  }
}


// The code to return the results (simplified)
def getRxAutoComplete(str: String): List[String] = {
  val list = List("Amoxicillin", "Amoximoxi", "Amoxia")
  list
}

2 Answers 2

1

The issue is that you are returning two different types in your match statement. The first returns a CssSel, and in the second you are returning a NodeSeq

You can fix it by either changing:

case List() => "*" #> NodeSeq.Empty

or use the ClearNodes method found in net.liftweb.util:

case List() => ClearNodes
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I did try using NodeSeq.Empty for one of the entries. The compiler then complains that one of the entries is a NodeSeq and the NodeSeq.Empty is an Int.
Sorry, I updated the answer after giving it a closer look.
0

You're missing an implicit conversion. You probably need to import some class of your library that defines such implicit conversions to bring them into your scope. Finding the exact name of this class is on you to make some research in your library's documentation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.