Skip to content
George Joseph edited this page Oct 20, 2019 · 1 revision

Derived from Element -> Widget

An "input" widget is a composite of an input field an optional "submit" button and an optional label.

{
	/*
	 * All attributes of Element and Widget apply here.
	 */

	"id": "my_input",
	"type": "input",
	
	/* label can be a simple text string... */ 
	"label": "Label",
	
	/* or an object with widget attributes */ 
	"label": {
		"style": {
			"height": "3em"
		},
		"value": "Label"
	}
	
	/*
	 * These parameters are applied to the input field itself.
	 */
	"input": {
		"id": "my_input",
		"field_type": "number",
		"value": "${status.temps.bed.active}",
		"style": {
			"text-align": "right"
		},
		
		/*
		 * The actions to perform when "enter" is pressed in the input field
		 * or when the button is clicked.
		 * "${value}" will be whatever the input field is set to when
		 * the submit action is triggered.
	 	*/	
		"actions": {"type": "gcode", "gcode": "Gsomething ${value}"}
	},
	
	/*
	 * These parameters are applied to the button.
	 * When the button is clicked, the input field will run its
	 * actions.
	 */
	"button": {
		"style": {"width": "50px"},
		"icon": "done",
		"actions": {"type": "event", "event": DUEUI.EVENTS.SUBMIT, "target": "#my_input"}
	}
}
Clone this wiki locally