Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example could use some code showing how to get data from the Modal #4

Closed
shorn opened this issue Sep 14, 2016 · 1 comment
Closed

Comments

@shorn
Copy link

shorn commented Sep 14, 2016

I've asked on stack overflow here: http://stackoverflow.com/q/39484920/924597

But basically, I can't figure out how to use the Bootstrap facade to get data back out of a modal after I use it to collect data from the user.
Maybe it's really obvious, but I'm new to all this client side stuff.

I'm hoping this tutorial here can help me, but that will involve not using the bootstrap facade:
https://github.com/ochrons/scalajs-spa-tutorial/blob/master/doc/en/integrating-javascript-components.md

@Karasiq
Copy link
Owner

Karasiq commented Sep 16, 2016

Try this

def showModal(kopiUser: KopiUser): Unit = {
  val data = Var("")
  def modal = Modal().withTitle("modal title").
    withBody(
      p(s"${kopiUser.displayName}, please enter your data"),
      Form(
        FormInput.text("fieldlabel", data.reactiveInput)
      )
    ).
    withButtons(
      Modal.closeButton(),
      Modal.button("Submit", Modal.dismiss, onclick := Bootstrap.jsClick { _ 
        // Do something with input
        window.alert(data.now)
      })
    )
  modal.show()
}

@Karasiq Karasiq closed this as completed Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants