Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Alberto Paro
    @aparo
    Hi. Thanks for the wonderful library.
    I try to manage a field that is a List[String] and the user in interface must add a new one or remove a String item form the list. But I was unable to achieve this with forms. May you give me some hints?
    Adam Warski
    @adamw
    hey :) so currently this is going to be tricky
    there are two options:
    1. if the possibilities come from a constrainted set of values, you can use the selectManyField see here. The value in the form then has to be Set[String], and it will be rendered as checkboxes
    2. if this is free-form string entry, than you would have to create a wrapper for the String (e.g. case class Item(name: String), create a simple form for that, and use subforms
    This message was deleted
    but you would have to manually add the "add" and "delete" buttons with appropriate actions
    @aparo if the solutions above don't fit what you need, it would be great to know how you would like things to work, so that we can adjust in the future :)
    Alberto Paro
    @aparo
    no thanks you, I try using 2 solution
    Tomasz Szymanski
    @szimano
    if i get the question right we already have an issue for that softwaremill/supler#35 so you can observe it (or help us with supler if you can/have time ;-) )
    Alberto Paro
    @aparo
    Ill create the Item Fake objects for common types then I send you a pull request
    Adam Warski
    @adamw
    @szimano I'm not sure if #35 would be very useful as you would probably want add/remove buttons, maybe move up/down. So this would rather be some kind of a component, not supporting subforms of "basic" types
    Tomasz Szymanski
    @szimano
    i think it would be useful for simple cases, as i forsee everyone trying it when playing with supler for the first time (happened with me and aparo ;-) ). and then i can imagine it can be useful where you just want to show some list with no extra buttons / actions etc.
    João Ferreira
    @jtjeferreira
    Hi. Is it possible to use supler without a case backing my model? I would like to use something as a Map[String, Any]
    Adam Warski
    @adamw
    @jtjeferreira Not currently, you can only use case classes or classes with vars. Using a Map could be an interesting use case, however we would have to work out some syntax to provide the desired type information (as all fields are typed). Please open an issue, if possible with a description of where this would be needed
    João Ferreira
    @jtjeferreira
    i was tryng to understand the macros and create myself the BasicFields. I will let you know how it goes
    João Ferreira
    @jtjeferreira
    Hi. i deployed supler.js 0.3.0 in http://www.webjars.org/
    Adam Warski
    @adamw
    @jtjeferreira thanks!
    is there any automated way to do this?
    João Ferreira
    @jtjeferreira
    if it is in bower yes
    Adam Warski
    @adamw
    it is :)
    João Ferreira
    @jtjeferreira
    http://www.webjars.org/bower just click "Add a New Bower WebJar"
    thats what i did
    if you mean automated as in sbt plugin, i dont know
    Adam Warski
    @adamw
    yeah that's what I meant
    I'll add an issue :)
    virtualirfan
    @virtualirfan
    anyone using supler with scalajs?
    Alberto Paro
    @aparo
    I massively, but It's a port and based on play json.
    Tomasz Szymanski
    @szimano
    anyone using supler on production already? is it public facing?
    virtualirfan
    @virtualirfan
    @aparo just wondering if you have a roadmap in mind or new pushes coming for scalajs-supler. Thanks!
    Alberto Paro
    @aparo
    @virtualirfan yes I'll update. I managed to migrate the datetime to play-json-extra and I'll update the scalajs-supler
    I'm working for opensourcing the bootstrap scalajs-react version that we have developed for the interface. But I think I'll first update it to scalajs-react 0.10
    virtualirfan
    @virtualirfan
    @aparo awesome!! thanks.
    João Ferreira
    @jtjeferreira
    any ideia on how to create a form for a ADT model?
    suppose we have a sealed trait Base, case class Foo extends Base, case class Bar extends Base
    and assuming I have a Form[Foo] and Form[Bar]
    i would like to create a Form[Base]
    In terms of frontend I imagine a select field that would allow me to select from foo and bar and display the correct subform
    but I am having trouble implementing the form model
    João Ferreira
    @jtjeferreira
    cc @adamw
    João Ferreira
    @jtjeferreira
    and another question. anyone tried recursive nested subforms? in a tree structure
    i am getting stackoverflows or nullpointer depending on how declare the forms vals vs def
    Adam Warski
    @adamw
    so, nested subforms should work fine, although maybe you've hit some corner-case
    I don't think we have some support for form-per-subclass yet, though it's an interesting idea - can you add an issue? or maybe even a PR :)
    João Ferreira
    @jtjeferreira
    For the ADT problem I found an work around but it involves a lot of boilerplate. Will have to think it through.
    Regarding the nested subforms, the problem is the recursive nature of the nesting because I have to pass the form definition for the children
    Adam Warski
    @adamw
    ah they are recursive ... well that probably would need some tweaks in the lib as well. Let us know what you arrive at :)
    João Ferreira
    @jtjeferreira
    hi @adamw. I created #62 to fix the discussed issue regarding recursive nested forms.
    Andrew
    @aepetelin
    Hi, have some problem with form.render(data) from example. Server side works pretty well, but frontend output is "nothing" ...
    Andrew
    @aepetelin
    Hi @adamw, need help with Actions, can't make 'em work. I followed the example, but println didn't invoked. There can I read more?
    import org.supler.Supler._
    val personForm = form[Person](f => List(
      f.field(_.name).label("Name"),
      f.field(_.age).label("Age").validate(gt(1), le(150)),
      f.field(_.address).label("Address"),
      f.field(_.likesChocolate).label("Do you like chocolate?"),
      f.action("save") { p =>
        println("Saving person: " + p)
        ActionResult.custom(JString("Saved"))
      }.label("Save").validateAll()
    ))