Is it possible to use events in an XLSForm?

It is not currently possible to directly use events in an XLSForm. Dynamic default support will make it possible to use odk-instance-first-load narrowly to set certain fields' values exactly once on load. Unfortunately, I don't know when this will be implemented.

If you don't need the value to be changed by the user, you can use once(your expression). In fact, you can use this to approximate a dynamic default, it just won't allow users to clear it.

I don't know of a reliable way to do something on form save. I don't believe any client has broad support for xforms-revalidate, hence why it's not documented. This would be a good event to add (but I'd prefer to close out some of the in-flight improvements rather than starting new things).

2 Likes