I would like to customize the RangeWidget for my project so that I can show text at the ends of the seek bar rather than numbers as is the current functionality. I would like not to have to change the
javarosa library or
pyxform package, and I hope I can put all my code additions inside the
RangeWidget class or its subclasses in ODK Collect. I would prefer to do this even if it tramples on the software design.
My thought is to add custom attributes in the
<bind> for the question (easily done with
pyxform and XLSForms). The result would be to have a bind such as:
<bind nodeset="/form/range_widget" startLabelCalculate="jr:choice-name( /form/start_label ,' /form/range_label_question ')" endLabelCalculate="jr:choice-name( /form/end_label ,' /form/range_label_question ')" type="int" />
end_label would refer to nodes with default string values. Those values would be choice names for a question
range_label_question so that we could handle translations. How can I obtain the attributes of the bind in the widget creation code? How can I evaluate the
For me it is OK that this is a hack-y approach. I just want to get this feature by editing ODK Collect.
By default, I could change the ODK Collect code to look up a string resource when creating the widget. I am hoping to have a solution like the above to allow the label to be set by the form designer.