google / paco

The Paco behavioral science mobile research platform
http://www.pacoapp.com/
Apache License 2.0
327 stars 93 forks source link

List choice label with < and character next to it are interpreted as html and not rendered #1570

Open BobEvans opened 7 years ago

BobEvans commented 7 years ago

Appears on the Android client. To recreate: Create a list choice question with one list choice containing "Frequency <5". Note that on the phone this question gets truncated after Frequency ".

josmas commented 6 years ago

This happens in all places, not just in lists. If you add a question title for an input such as Is Frequency <5? you will see the same issue.

But this only happens if there is a character right after the < sign, such as <5 but not if there is a space, for instance: Frequency < 5. Also closing the sign with > will skip whatever is in between both signs, and render the rest (left and right).

Is HTML in the questions and answers something wanted? For instance a question could be: Are you <b>really</b> sure? and it would display as: Are you really sure? in the app (it works, I've tested it).

If that is the case, then there is nothing to fix. Just warn users that HTML is allowed in the form fields for inputs. If that is not the case, then I believe the fix is not to interpret the HTML text in InputLayout.java, in places such as lists listChoices.add(Html.fromHtml(currentChoice)); and other textual values.

I'd be happy to prepare a PR if HTML should NOT be allowed; can anyone confirm?

BobEvans commented 6 years ago

HI,

The goal is to allow html in the Input text and the list choices or scale labels to give some flexibility in formatting without having to create a completely custom html form.

Thanks, Bob

On Mar 9, 2018, at 10:49 AM, Jos notifications@github.com wrote:

This happens in all places, not just in lists. If you add a question title for an input such as Is Frequency <5? you will see the same issue.

But this only happens if there is a character right after the < sign, such as <5 but not if there is a space, for instance: Frequency < 5. Also closing the sign with > will skip whatever is in between both signs, and render the rest (left and right).

Is HTML in the questions and answers something wanted? For instance a question could be: Are you really sure? and it would display as: Are you really sure? in the app (it works, I've tested it).

If that is the case, then there is nothing to fix. Just warn users that HTML is allowed in the form fields for inputs. If that is not the case, then I believe the fix is not to interpret the HTML text in InputLayout.java, in places such as lists listChoices.add(Html.fromHtml(currentChoice)); and other textual values.

I'd be happy to prepare a PR if HTML should NOT be allowed; can anyone confirm?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.

josmas commented 6 years ago

Hey @BobEvans, thanks for the reply.

So there's nothing to fix then, just warn users that they should use Frequency &lt;5 if they want the above in any question heading or answer choice?