Form Widget on Dashboard and IoT Applications

The form widget allows to dynamically create a form for user input collection on the Dashboard. The input kind can be :

  • text,number, email, password, checkbox, switch, data, time.

A good example is reported in the following. The form widget in the IoT App Node-RED has the following node symbol.

The form on dashboard can be realized by configuring the form node into IOT App, or sending the configuration JSON into the node as follows:

the JavaScript to send the JSON is as follows:

msg.payload ={ "form": { "options": [
{ "label": "enter text", "value": "", "type": "text", "required": true }, 
{ "label": "enter number", "value": "", "type": "number", "required": false }, 
{ "label": "enter email", "value": "", "type": "email", "required": false }, 
{ "label": "enter password", "value": "", "type": "password", "required": false }, 
{ "label": "enter check", "value": "checked", "type": "checkbox", "required": false }, 
{ "label": "enter check2", "value": "", "type": "checkbox", "required": false }, 
{ "label": "enter switch", "value": "on", "type": "switch", "required": false }, 
{ "label": "enter switch2", "value": "", "type": "switch", "required": false }, 
{ "label": "enter date", "value": "", "type": "date", "required": false }, 
{ "label": "enter time", "value": "", "type": "time", "required": true }
 ], "selected": [] } } 
return msg;
 

The resulting message in JSON will report the input performed by the user:

"selected":["a text","123", "paolo.nesi@unifi.it","aaaaaa", "checked","","on","","2021-03-19","09:38"]

 

 

 

Form Widget on Dashboard and IoT Applications | Snap4City

Error

×

Error message

  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Unable to send e-mail. Contact the site administrator if the problem persists.
  • Notice: Trying to get property of non-object in user_is_logged_in() (line 1576 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_is_logged_in() (line 1576 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in og_field_access() (line 578 of /var/www/html/drupal/sites/default/modules/og/og.module).
  • Notice: Trying to get property of non-object in user_access() (line 806 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 818 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 819 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 825 of /var/www/html/drupal/modules/user/user.module).
  • Notice: Trying to get property of non-object in user_access() (line 828 of /var/www/html/drupal/modules/user/user.module).
  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/drupal/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/drupal/includes/bootstrap.inc).
  • Error: __clone method called on non-object in og_user_access_entity() (line 2249 of /var/www/html/drupal/sites/default/modules/og/og.module).
The website encountered an unexpected error. Please try again later.