Ability for client side 'callouts' such as postalcode validation

20 views
Skip to first unread message

Jan Cirpka

unread,
Apr 16, 2021, 6:50:53 AM4/16/21
to enketo-users
Exploring the capabilities of Enketo I wonder if it is possible to add client side 'callouts'. The scenario I envision is validation of a (Dutch) postalcode using a client side REST call which in it's return provides city and street (to be shown to the user).
Technically I assume that this translates to capturing the postalcode's field "OnChange" event to invoke the REST call. Probably one would like to show an hourglass while the REST call is processed. Once the results are in, subsequent fields on the form with city and street than should get 'auto filled'.
Is something described above possible? Where would I start to learn how to accomplish this?
Kind regards
Jan

Martijn van de Rijdt

unread,
Apr 16, 2021, 11:50:59 AM4/16/21
to enketo...@googlegroups.com
Hallo Jan,

Enketo (core) facilitates asynchronous validation of fields. Medic Mobile is using this in their hybrid mobile data collection client to validate phone numbers. So that is feasible.

Retrieving values with an asynchronous call and then populate other values is far more complex. Including ALL data in a CSV or XML file upon form load is not feasible, right?

Some ideas on populating fields with retrieved values:

- add functionality to update an external instance (e.g. a new "action" upon a xforms-value-changed event on the postal code field).
- add a new event that fires when an external instance has been updated
- add support for a setvalue action when that event is detected

I hope this helps,

Martijn

--
You received this message because you are subscribed to the Google Groups "enketo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enketo-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/enketo-users/af4ae47b-06b5-4ca5-98ee-51e3cb781cbdn%40googlegroups.com.


--
Pushing data since 2012.

Enketo    |    LinkedIn    |    GitHub    |    Twitter    |    Blog

-- 
Revolutionizing data collection since 2012.

Enketo    |    LinkedIn    |    GitHub    |    Twitter    |    Blog

Jan Cirpka

unread,
Apr 17, 2021, 11:45:36 AM4/17/21
to enketo-users
Thnx for your thoughts Martijn. Clearly it is a stretch to get this to work. I wonder how often a wish like mine comes around. The idea to asynchronously 'add' (or validate) data using a REST call looks quite generic. 
Reply all
Reply to author
Forward
0 new messages