Adam Warski

19 Mar 2015

Supler update: 0.3.0 release

scala
web

It’s been some time since the last release of Supler. Just as a short reminder: Supler is a Rapid Form Development library, allowing you to use your favorite Javascript frontend, and Scala backend frameworks. It keeps the form definition centralized, taking care of client/server-side validation, form rendering, applying new values and serializing/deserializing. Star Supler on GitHub if you think that might be interesting!

If you’re new to Supler, or if you’d like to get started with form development using Supler, take a look at our docs or the live demo.

The 0.3.0 release brings a lot of smaller and bigger improvements as well as bug fixes (a mandatory position in each release of any software ;) ). It is now possible to customise a number of field options on the frontend, starting with specifying the field order, to more specific per-field options like render hints or overriding rendering functions using javascript (it is still possible of course to override rendering using HTML templates). A short example of how field options may look like:

new Supler.Form(container, {
field_options: {
  'secretField': {
    render_hint: 'password' 
  },
  'friends[].bio': {
    render_options: {
      renderLabel: function(forId, label) { return '

<div>
  some html
</div>'; } 
    }
    read_value: function(element) { return ... } 
  },
  'render_hint:radio': {
    // options common for all fields rendered as radios
  }
});

Before the only way to layout fields was one field per row. Now it is also possible to have multiple fields in one row; just combine the fields using the || operator:

form[Person](f => List(
  // row 1
  f.field(_.age).label("Age") || f.field(_.birthday).label("Birthday"),
  // row 2
  f.field(_.address1).label("Address 1") || f.field(_.address2).label("Address 2")
)

The row decorations and how rows are rendered is of course fully customisable via overriding the javascript rendering functions. We are also looking into making this more flexible, with frontend-defined form layout templates.

Other changes include:

  • more validators for basic types
  • improved option validators
  • improved single/multi-select fields support
  • easier definitions of custom transformers (for serializing/deserializing custom classes to/from json).
  • support for fields which serialised to complex JSON objects (not plain strings/numbers etc.)

We also have a new Bintray/Artifactory/Travis-based build system, which fully automates the releases so snapshots are always up-to-date!

As always, if you like the project, please start it on Github or let us know your opinion either here, on the forum or on the Gitter chat!

comments powered by Disqus

Any questions?

Can’t find the answer you’re looking for?