Skip to content
Permalink
Browse files

Added better overriding support for FieldError's underlying element

  • Loading branch information...
darkfrog26 committed Mar 21, 2019
1 parent b204a68 commit af279d25e750f1e0b8a37785834e80e9e6e1f36f
@@ -3,7 +3,7 @@ import sbtcrossproject.CrossPlugin.autoImport.crossProject

name := "youi"
organization in ThisBuild := "io.youi"
version in ThisBuild := "0.10.10"
version in ThisBuild := "0.10.11-SNAPSHOT"
scalaVersion in ThisBuild := "2.12.8"
crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12")
resolvers in ThisBuild += Resolver.sonatypeRepo("releases")
@@ -2,13 +2,16 @@ package io.youi.form

import io.youi.dom.create
import org.scalajs.dom.html
import org.scalajs.dom.html.Element

case class BootstrapFieldError(input: FormInput) extends FieldError {
private val errorDiv = create[html.Div]("div")
errorDiv.classList.add("invalid-tooltip")
clear()
input.element.parentElement.appendChild(errorDiv)

override lazy val element: Option[Element] = Some(errorDiv)

override def show(message: String): Unit = {
errorDiv.innerHTML = message
errorDiv.style.display = "block"
@@ -1,7 +1,10 @@
package io.youi.form

import org.scalajs.dom.html

trait FieldError {
def input: FormInput
def element: Option[html.Element]

def show(message: String): Unit
def clear(): Unit

0 comments on commit af279d2

Please sign in to comment.
You can’t perform that action at this time.