Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8288 multi line textarea in guestbook #8291

Merged
merged 7 commits into from
Jan 20, 2022

Conversation

mdmADA
Copy link
Contributor

@mdmADA mdmADA commented Dec 8, 2021

What this PR does / why we need it:
Adds an expandable textarea customquestion questiontype for the guestbook.
The text area starts out with 8 lines but is expandable to as many as required.

Which issue(s) this PR closes:

Closes #8288

Special notes for your reviewer:

Suggestions on how to test this:
Create a new guestbook. For the question type, there should now be 3 choices: Text, Text Area, Multiple Choice
Choose 'Text Area'.
Assign this guestbook to a dataset.
Log in as a regular user and navigate to the dataset assigned the guestbook in the previous step.
Download a file. Ensure the custom question set as 'Text Area' is a multi-line expandable textarea component.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Yes but minor. Simply allows a larger multi-line textarea input.

Changes to Guestbook Creation Process:

Screen Shot 2021-12-09 at 9 51 03 AM

Changes to Guestbook display:

Mutltiline textarea in guestbook screenshot

Is there a release notes update needed for this change?:
Not sure.

Additional documentation:
The 'response' field of the customquestionresponse table is of type 'text' which allows unlimited text so adding a textarea should not be an issue.

@coveralls
Copy link

coveralls commented Dec 8, 2021

Coverage Status

Coverage remained the same at 18.912% when pulling da33445 on mdmADA:8288-multi-line-textarea-in-guestbook into 80a42de on IQSS:develop.

@djbrooke
Copy link
Contributor

djbrooke commented Dec 8, 2021

Thanks @mdmADA. We'll review the code, but can you add a screenshot when you have a chance? Thanks!

@mdmADA
Copy link
Contributor Author

mdmADA commented Dec 8, 2021

I added the screenshot to the description above ^^. Thanks Danny.

@djbrooke
Copy link
Contributor

djbrooke commented Dec 9, 2021

Thanks @mdmADA! I think this provides a much better writing experience for those filling out guestbooks.

@TaniaSchlatter - I added one additional screenshot above (of the create process). My big question is if "Text Area" is the right wording here from your perspective.

FWIW, Qualtrics has three options that provide various entry lengths:

  • Single Line
  • Multiple Line
  • Essay Text Box

I'm not suggesting three options but it's interesting to see their wording on the options, and it's another tool used often by researchers.

Screen Shot 2021-12-09 at 8 33 38 AM

Screen Shot 2021-12-09 at 8 33 24 AM

Screen Shot 2021-12-09 at 8 33 09 AM

@TaniaSchlatter
Copy link
Member

Thanks for the screenshots, @mdmADA. It's great to have this useful functionality. I'd support naming that is a little more clear. @djbrooke mentioned Qualtrics naming. Google Forms uses "short answer" and "paragraph" for two text entry options. I think either "single line" and "multiple line" or "single line" and "paragraph" provide clearer naming.

@TaniaSchlatter TaniaSchlatter removed their assignment Dec 9, 2021
…for textarea of guestbook to 'Multiple Line' to make it clearer.
@mdmADA
Copy link
Contributor Author

mdmADA commented Dec 9, 2021

Thank you both for the feedback - your suggestions do make it clearer.

I will go with the 'Single Line' and 'Multiple Line'.
I have left the Custom Question Type as 'text' for 'Single Line' and 'textarea' for 'Multiple Line' so there doesn't have to be a database update to the question type for 'text'.

Let me know if you would like anything changed. Thanks!

@djbrooke
Copy link
Contributor

djbrooke commented Dec 9, 2021

Thanks @mdmADA and @TaniaSchlatter !

@sekmiller all yours!

Copy link
Contributor

@sekmiller sekmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you for this enhancement!

@sekmiller sekmiller removed their assignment Dec 13, 2021
@kcondon kcondon self-assigned this Dec 13, 2021
@kcondon
Copy link
Contributor

kcondon commented Dec 13, 2021

@mdmADA Would you please refresh from develop? We've recently released v5.9 and the version is part of the code and I need it to build and test, thanks.

@djbrooke
Copy link
Contributor

@kcondon I went ahead and updated from develop

@kcondon
Copy link
Contributor

kcondon commented Dec 13, 2021

@mdmADA This generally works but noticed that responses in the text area type that span multiple lines is handled differently by different opening apps -dataverse converts cr to spaces, excel keeps up to the first cr and puts the rest in a new row, first column, numbers appears to do something similar to Excel. Anyway that content can be confined to the cell it is supposed to be in, maybe writing out response in quotes?

here are some examples:
Screen Shot 2021-12-13 at 5 07 35 PM
Screen Shot 2021-12-13 at 5 08 30 PM
Screen Shot 2021-12-13 at 5 09 17 PM
Screen Shot 2021-12-13 at 5 20 04 PM
Screen Shot 2021-12-13 at 5 20 54 PM
Screen Shot 2021-12-13 at 5 22 30 PM

@kcondon kcondon assigned mdmADA and unassigned kcondon Dec 13, 2021
@mdmADA
Copy link
Contributor Author

mdmADA commented Dec 14, 2021

Good catch @kcondon. I was only thinking of text input, and not how it might be read after the fact and didn't think to test that.

I will see if writing the response in quotes addresses the issue and let you know.

@mdmADA
Copy link
Contributor Author

mdmADA commented Jan 4, 2022

@kcondon - I updated the selectCustomQuestionAnswers() method in GuestbookREsponseServiceBean.java to escape the values pulled from the database for writing to csv files. It will work with responses containing newline, comma and/or double quotes.

I tested with Excel and Numbers (noting that you have to fix the setting sin numbers to delimited instead of fixed length for it to show properly).

I fixed the UI so it also shows newlines in the guestbook-responses.xhtml to keep things consistent between the ui and excel, etc. by replacing any newlines in the response text pulled from the database with "
" in the GuestbookResponseServiceBean.java selectCustomQuestionAnswers(). I believe selectCustomQuestionAnswers() is only called (eventually) by guestbook-responses.xhtml so shouldn't be a problem.

I also had to change guestbook-responses.xhtml to use outputText so I could set escape="false" so the
's would render as newlines and not as text. I think that is ok, as it is not text being entered by a user.

Let me know if there are any changes needed.

…onse pulled from db with <br /> so the newlines will render in the UI (guestbook-responses.xhtml)
…it escape="false" so any <br />'s in the customQuestion responses will render as newlines in the UI.
@djbrooke
Copy link
Contributor

Thanks @mdmADA for the updates to this issue, we'll take another look!

@kcondon kcondon self-assigned this Jan 20, 2022
@kcondon kcondon merged commit fbb5ed8 into IQSS:develop Jan 20, 2022
@djbrooke djbrooke added this to the 5.10 milestone Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request/Idea: Allow multi-line textarea inputs for guestbook
6 participants