Checkout my code, especially parts with "cssClass". import net.liftweb.http.S._ import net.liftweb.http.SHtml._
// input can be SHtml.text def formField(label: String, input: Elem): NodeSeq = { val fixedLabel = label match { case "" => "" case s: String => s + ":" } val id = (input \ "@id").toString val messageList = messagesById(id)(errors) val hasMessages = messageList.size > 0 val cssClass = if (hasMessages) "ErrorField" else "" val messages = messageList match { case list: List[NodeSeq] if hasMessages => { <ul>{messageList.map(m => <li>{m}</li>)}</ul> } case _ => Nil } <table class={cssClass} style="width: 100%;"> <tr> <td style="text-align: right; vertical-align: top; width: 10em;"> <b>{fixedLabel}</b> </td> <td style="text-align: left;"> {input}{messages} </td> </tr> </table> } On 4 дек, 23:22, wstrange <warren.stra...@gmail.com> wrote: > I have searched the archives, but the answer is not immediately clear > to me... > > How does one provide field validation feedback on a form (e.g. turn > the phone number field red if an error is made in data entry)? The > S.error approach of collecting all the errors into one big message > seems unwieldy, and does not give the user very good feedback. I am > using JPA if that makes any difference. > > Any tips would be appreciated -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.