Skip to content
Pierre Besson edited this page Jan 12, 2015 · 3 revisions

The binder helper is used in order to tranform data just after html parsing. The binder is published under the namespace: Fmk.Helpers.binderHelper.

The process is as follows:

  • form (html) -> parsing(js) -> binding(js) -> validation(js) -> service(js)-> http or localDb

In order to be called a binder muse be registered under a name. Just call the method

Focus.binderHelper.register({name:transformName,fn: function transformName(val, options){ return val;}})

. The function must take the value as argument and is able to transfrom it.

The in the domain you can add a reference to the binder:

{
"DO_NAME": {
  "binder": {
     "name": "transformName"
  }
 }
}

The it will be automatically called if your html has the attribute data-binder which should be automatic with the view_helper.

  <input name="nom" data-name="nom" data-binder="transformName"/>
Clone this wiki locally