XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
77 stars 134 forks source link

Extending appearance #618

Closed JustinSteventon closed 1 year ago

JustinSteventon commented 1 year ago

I emailed info@xlsform.org and the Ona folks pointed me here. Please repoint if needed.

I want to use XlsForm as a form language, but add a richer way to describe custom UI. The users I support are not able to use a text oriented UI and also need specialized widgets. I have already built an XlsForm engine, so this would really be used.

For example, suppose the appearance column contains: “widget(‘grid’,4,’icons’)”. The form renderer could go and find ‘grid’ on a server, download it and parameterize it with ‘4’ (columns) and ‘icons’. In this case, ‘grid’ is be a UI definition file.

It would be great to have a conversation with the XlsForm designers to see if something like this makes sense to them.

lognaturel commented 1 year ago

appearance is passed through so you can use it in client-specific ways. You can see a related example at https://blog.enketo.org/gorgeous-grid/

JustinSteventon commented 1 year ago

Great, so I can repurpose 'appearance' as needed. Hopefully adding more complex expressions here does not break any of the other form engines.

Would I be able to do the same with 'parameters'?

I notice that ESRI has their own namespace (bind::esri:: and body::esri::). Is there a way for me to get my own namespace as well?

lognaturel commented 1 year ago

Hopefully adding more complex expressions here does not break any of the other form engines.

I don't think so! The ones I know look for appearances they support and discard any they don't.

Would I be able to do the same with 'parameters'?

No, parameters are validated and converted to their appropriate XForms equivalent. However, you can use instance::, bind:: and body:: to pass through anything you want to the XForm instance, bind or body. Those names don't really make sense if you're directly working with XLSForms but they're supported. You can specify custom namespaces on the settings sheet: https://xlsform.org/en/#advanced-use-and-extensibility

JustinSteventon commented 1 year ago

I missed adding the namespace to the settings sheet. After doing that, my custom columns are intact through KoBo, ODK and Survey123. Thanks for the help!