In this article we will develop a watch action for form submits within the Sky Event API. Previously we have done CRUD with KRL, which enables the development of data storage modules. While the watch() action works well with the current Blue API, it does not yet support the Sky Event API. We have added a watch_submit() defaction to the SkyKit module so that you can create a data storage module in your Personal Cloud.


The demo ruleset is executed as a site tag. The ruleset executes a raise_delegate() into a Personal Cloud, with event type formTest.

SkyKit:raise_delegate("formTest", "f6511bf0-9ba1-012f-7a7a-00163e64d091")

With the data storage module ruleset installed in the Personal Cloud, the formTest rule is fired:

rule formTest {
  select when web formTest
  pre {
    eci = "f6511bf0-9ba1-012f-7a7a-00163e64d091";
    firstName = ent:firstName || "";
    lastName  = ent:lastName || "";
  }
  {
    SkyKit:watch_submit("#formDemo", eci);
    emit <<
      $K('#firstName').val(firstName);
      $K('#lastName').val(lastName);
    >>;
  }
}

This rule sets a watch for form submit and displays the current values within the data store. When the form is submitted a Sky Event will be raised into the Personal Cloud associated with the Event Channel Identifier.

rule formSubmit {
  select when web submit "#formDemo"
  pre {
    firstName = event:attr("firstName");
    lastName  = event:attr("lastName");
  }
  { noop(); }
  fired {
    set ent:firstName firstName;
    set ent:lastName lastName;
  }
}

The formSubmit rule will be fired when the form is submitted, saving the values into the data store.


Enjoy!