Text input 'two-way binding' for a command

So I have a widget which binds to an operation

binding 'node' {
	'command': binding 'operation' {
		'widget' on 'parameters': widget
	}
	// ...
}

And I use the following text input widget inside the command field of the previous widget

binding 'node' {
	'text': binding 'text' { }
}
control 'text input' {
	// ...
}

When I bind the text in the command to the text in the text input widget (ex. 'text':: text 'Question title' { }) I get an interesting behavior. The default values from the command get transferred to the text in the text input, but then when I change them and execute the command the new values are not used so the binding is only one-way.

Properties in widgets are always bound one way. Use the event from the controls (e.g. on change) to update the state using instructions.

control 'text input' {
	'text' = switch $ ::'text'.'is set' (
		|'no' => ""
		|'yes' => .'text'
	)
	'on change' = $ ::'text'>>'update text' ( text argument )
}
1 Like

Thank you! It worked.