Units / Append or Prepend

Add-ons

Prepend (Glyph-) icon and/or text before and/or after any input* field.

* This does not work for fieldtypes like textarea, date, radiobutton etc., only for input.

// file: hooks/patients-dv.js
new AppGiniField("weight")
  .prependIcon("download-alt")
  .append("kg");
new AppGiniField("height")
  .prependIcon("resize-vertical")
  .append("cm");
// file: hooks/patients-dv.js
new AppGiniField("weight")
  .prepend("in kg", "download-alt");

new AppGiniField("height")
  .append("cm","resize-vertical");

Units (alias for append)

This is only a shotcut for .apppend() function without icon, just text. This function is useful for example in every numeric input field where a unit is required like $, €, km, m, cm, kg, g, t, litres, …

// file: hooks/patients-dv.js
new AppGiniField("mobile")
    .label("Phone")
    .unit("ICE");

Tipp

You can your those functions on readonly fields, too.

var dv = AppGiniHelper.DV;
 dv.ready(function(){
     new AppGiniField("memberEmail").prepend("E: ");
 });
var dv = AppGiniHelper.DV;
 dv.ready(function(){
     new AppGiniField("memberEmail").prependIcon("envelope");
 });
var dv = AppGiniHelper.DV;
 dv.ready(function(){
     new AppGiniField("memberEmail").prepend("Email-Address: ", "envelope");
 });
var dv = AppGiniHelper.DV;
 dv.ready(function(){
     new AppGiniField("memberEmail").prepend("Email-Address: ").appendIcon("envelope");
 });

See also

Do you like it?