2017 © Pedro Peláez
 

silverstripe-module silverstripe-spinner-field

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

image

janneklouman/silverstripe-spinner-field

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  • Tuesday, May 8, 2018
  • by janneklouman
  • Repository
  • 1 Watchers
  • 0 Stars
  • 115 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 8 Versions
  • 6 % Grown

The README.md

Spinner field for SilverStripe

A spinner field for SilverStripe using jQuery UI's Spinner Widget providing a nice interface for number input fields and the ability to customize them., (*1)

Requirements

"require": {
    "php": "^5.4",
    "silverstripe/framework": "~3.1"
}

Installation

composer require jjjjjjjjjjjjjjjjjjjj/silverstripe-spinner-field, (*2)

Example usage

SpinnerField::create(

    // Field name
    'Answer',

    // Label
    'What is the answer to the ultimate question of life, the universe, and everything?',

    // Initial value
    rand(0, 42),

    // Optional options (see available options below under heading: UI settings)
    [
        'min'  => 0,
        'max'  => 42,
        'step' => 3 // Increment and decrement in steps of 3
    ]

);

Configuration

UI settings

You can configure the spinner widget's UI by passing an array of options in the constructor like shown above, or you could do something like:, (*3)

// Setting a batch of options.
$spinnerField->setUIOptions(
    [
        'disabled'  => true,
        'max'       => 314159265359,
        'page'      => 100000000000,
        'icon_up'   => 'ui-icon-plus',
        'icon_down' => 'ui-icon-minus'
    ]
);

// On second thought...
$spinnerField->setUIOption('disabled', false);

Here's a list of available UI options. See https://api.jqueryui.com/spinner/ for detailed description of the options and what they do., (*4)

// Available options and their default values
[
    culture      => null,
    disabled     => false,
    icon_down    => 'ui-icon-triangle-1-s',
    icon_up      => 'ui-icon-triangle-1-n',
    incremental  => true,
    max          => null,
    min          => null,
    numberFormat => null, // Currently only 'n'||null is supported
    page         => 10,
    step         => 1
]

Field settings

/**
 * Enforce step validation. Will cause validation to fail if input is
 * not evenly divisible with the 'step' UI option. Example: if 'step'
 * is set to 4, validation will fail for 0 !== $input % 4
 *
 * @var bool
 */
protected $enforceStepValidation = false;

```PHP /** * Will cause validation to fail if input is below the 'min' UI option. * * @var bool */ protected $enforceBelowMinValidation = true;, (*5)

```PHP
/**
 * Will cause validation to fail if input is above the 'max' UI option.
 *
 * @var bool
 */
protected $enforceAboveMaxValidation = true;

Furthermore see NumericField for inherited field settings., (*6)

The Versions

08/05 2018

dev-master

9999999-dev

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe field spinner

18/07 2016

dev-develop

dev-develop

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe field spinner

18/07 2016

v1.1.3

1.1.3.0

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe field spinner

09/07 2016

v1.1.2

1.1.2.0

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe field spinner

02/07 2016

v1.1.1

1.1.1.0

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

MIT

The Requires

 

silverstripe field spinner

26/06 2016

v1.1.0

1.1.0.0

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

MIT

The Requires

 

silverstripe field spinner

24/06 2016

v1.0.1

1.0.1.0

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

MIT

The Requires

 

silverstripe field spinner

24/06 2016

v1.0.0

1.0.0.0

A spinner field for SilverStripe using jQuery UI's Spinner Widget.

  Sources   Download

MIT

The Requires

 

silverstripe field spinner