I’ve started to play with some features added in 8.3 and am trying to implement an offline-friendly form for data collection. I believe I understand how to use events and build in basic functionality.
One thing I’m curious about, though, is what the pipeline that runs after submitting a form does. It seems to be fully internal and not exposed for modification. Is that right?
A couple things which I might like to be able to do;
Add metadata to the form submission or merge forms before submitting
Prevent form submission; thus leveraging the UI of the form but doing something else with the data using onSubmitActionPerformed as a hook for a script without harassing the gateway
Do some math on form values (so that human friendly values could be input and converted to different units later)
The first and third could definitely be delegated to the form submission received gateway event script, but I figure why make the gateway do extra work if the form could simply be modified by the client before being sent. The second I am unsure of. Does a form’s data get effectively discarded if the gateway event doesn’t do anything with the data?
Beyond that, I feel I don’t quite understand everything about sending data back using offline mode. Are there other facilities for queueing up data transfer than the form component? The documentation feels a little sparse, stating only “…so you can launch projects without a Gateway connection and queue supported interactions such as form submission for automatic delivery once connectivity is restored.”
All Perspective scripts and expressions run on the gateway, not the client, because the client is essentially a web browser and we don't want folks who are working in Perspective to have to learn Javascript.
With that in mind...
A laudable goal...but how would that work without your code running locally?
This is my understanding, yes. I don't know if there's a way to prevent a form from going through the batching/queuing/submission system though.
This is weaselly-wording to give us room in the future. Basically, right now offline mode ~only works with the form component (see my first point about scripts and expressions) but there's a potential future where things like basic local property bindings continue to work while you're in offline mode (up until you hit something that needs an expression or script).
Even in offline mode? My understanding was that local event scripts would still work so I could, for example, change the text of a label as part of a button’s onActionPerformed event script. Although now that I’m thinking about it I’m not 100% sure what makes some events ‘local’.
There are actions that happen entirely on the frontend in Perspective - e.g. navigation by URL, which is just doing something in the local browser, no need to call out to the gateway. But it's not particular clear as an end user which is which, and even then I don't actually know which are currently supported in an offline mode "session".
Thanks for the information guys. This is pretty restrictive for the task I've been set and I think won't work out. Which is great to find out now, rather than later!