Versions Compared
| Version | Old Version 9 | New Version 10 |
|---|---|---|
| Changes made by | ||
| Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
| Table of Contents |
|---|
Description
Submit buttons are aesthetically similar to normal buttons but their behaviour differs from normal buttons with respect to the following:
- They allow data captured on the view to be submitted to a unit
- They do not allow for usage without an action function binding
Visibility bindings and the confirm dialog is also supported.
Example
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
<textarea label="input.workout_comments"> <binding variable="uWorkout"> <attribute name="comments"/> </binding> </textarea> <submit label="button.save_workout" action="saveWorkout"/> |
| Code Block | ||||||
|---|---|---|---|---|---|---|
| ||||||
unit Workouts;
Workout uWorkout;
void init() {
uWorkout = Workout:new();
}
.
.
.
DSL_VIEWS saveWorkout() {
uWorkout.endTstamp = Date:now();
uWorkout.save();
init();
return DSL_VIEWS.Workouts;
} |
| Code Block | ||
|---|---|---|
| ||
button.save_workout = Save workout |
The above example shows a very typical use case where data is submitted after which the view is reloaded by means of a navigation to the same view. Note that when navigating from a view to itself, the view is reloaded in that any collection sources for widgets on the view are re-evaluated. The init function, however, will not be executed. A view init function will only be executed when navigating to the view from a different view or as a result of a menu navigation. For that reason we include a call to init in the saveWorkout function in the code snippet above. This ensures that a new workout object instance is instantiated despite the init function not being called automatically.
Additional Mentions and References
- Shown in code example in the Helium Tutorial Lesson 5: Model Objects, Enums
- Helium DSL and View Quick Reference