Some recent change has broken Enketo. Loading a form either as a new report or a new contact fails with...
Error loading contact form. Error: ["FormLogicError: Could not evaluate: selected(../contact_dob_method,'calendar'), message: haystack.split is not a function"]
at enketo.js:191
at processQueue (angular.js:16843)
at angular.js:16887
at Scope.$digest (angular.js:17982)
at angular.js:18211
at completeOutstandingRequest (angular.js:6274)
at angular.js:6554
When I revert to https://github.com/medic/medic-webapp/commit/c5c64b9932d1913bd8ad7f5aadb27028e09824c5 (from 11 days ago) it works as expected.
@alxndrsn Any ideas?
Yes. Is this form deployed to a server I can access it on? Failing that, can you share the form?
Also would be helpful to see the code where the exception is thrown, if you can easily share a screenshot (unminified if available, or failing that pretty-printed).
It's failing on all forms I have. I'll try to get it failing on a server you can access.
That stacktrace is using a sourcemap so it's actually useful. This is the line it's referring to: https://github.com/medic/medic-webapp/blob/master/static/js/services/enketo.js#L191
It's just one of the load errors from the Enketo library which unfortunately doesn't tell you much about where it happened (it's not an Error, just a string).
@alxndrsn alpha.dev has been updated and is now failing in the same way. Try this form as admin: https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/#/reports/add/assessment
I just had a crazy idea - it might be a jquery 3 thing. IIRC we hardcode to jquery 2 but I noticed that this later enketo wants jquery 3.
Most likely that ../contact_dob_method is not resolving correctly after upgrading enketo.
N.B. the form linked at https://alpha.dev.medicmobile.org/medic/_design/medic/_rewrite/#/reports/add/assessment does not contain selected(../contact_dob_method,'calendar').
@garethbowen do you get the same error message as in the original report for this form locally?
selected() calls are being passed boolean values instead of string values
On the linked form I get:
Error loading form. Error: ["FormLogicError: Could not evaluate: selected( /model/instance[1]/assessment/group_fever/mrdt_result , 'none'), message: a.split is not a function"]
at inbox.js:68
at i (inbox.js:10)
at inbox.js:10
at n.$digest (inbox.js:10)
at inbox.js:11
at e (inbox.js:9)
at inbox.js:9
Same error, different field.
Works for me!