Files
vivespos-landing/modules/system/assets/ui/docs/input-trigger.md
avives 1f72193a64
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
- Base: wintercms/winter branch 1.2 (full framework)
- Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS
- Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication
- Partials: hero (offline-first), features, modes (offline/nube toggle),
  screenshots, pricing (3 planes), comparison, FAQ, CTA
- Plugin VivesPOS.Site with ContactForm
- Dockerfile: PHP 8.2 Apache, port 80, healthcheck
- Added winter/wn-pages, blog, sitemap, seo plugins
- Active theme set to vivespos
2026-08-21 19:29:00 -06:00

2.5 KiB

Input Trigger API

The API allows to change elements' visibility or status (enabled/disabled) basing on other elements' statuses. Example: enable a button if any checkbox inside another element is checked.

Example

Checked condition

<input type="checkbox" id="triggerChk1" />
<button class="btn disabled"
    data-trigger-action="enable"
    data-trigger="#triggerChk1"
    data-trigger-condition="checked">
    Check the checkbox
</button>

Value condition

<p>
    <input
        type="text"
        id="triggerTxt1"
        value=""
        onkeyup="$(this).trigger('change')"
        placeholder="Enter 'foo' or 'bar' here"
        class="form-control" />
</p>

<div
    class="callout callout-success"
    data-trigger-action="show"
    data-trigger="#triggerTxt1"
    data-trigger-condition="value[foo][bar]">

    <div class="content">
        Passphrase is valid!
    </div>
</div>

Supported data attributes

  • data-trigger-action, values: show, hide, enable, disable, empty
  • data-trigger: a CSS selector for elements that trigger the action (checkboxes)
  • data-trigger-condition, values:
    • checked: determines the condition the elements specified in the data-trigger should satisfy in order the condition to be considered as "true".
    • unchecked: inverse condition of "checked".
    • value[somevalue]: determines if the value of data-trigger equals the specified value (somevalue) the condition is considered "true".
  • data-trigger-closest-parent: optional, specifies a CSS selector for a closest common parent for the source and destination input elements.

Example code:

<input type="button" class="btn disabled"
    data-trigger-action="enable"
    data-trigger="#cblist input[type=checkbox]"
    data-trigger-condition="checked" ... >

Multiple actions are supported:

data-trigger-action="hide|empty"

Multie value conditions are supported:

data-trigger-condition="value[foo][bar]"

Supported events

  • oc.triggerOn.update - triggers the update. Trigger this event on the element the plugin is bound to to force it to check the condition and update itself. This is useful when the page content is updated with AJAX.
  • oc.triggerOn.afterUpdate - triggered after the element is updated

JavaScript API

$('#mybutton').triggerOn({
    triggerCondition: 'checked',
    trigger: '#cblist input[type=checkbox]',
    triggerAction: 'enable' 
})