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

Simpler array input #2176

Closed
RFSH opened this issue May 2, 2022 · 1 comment
Closed

Simpler array input #2176

RFSH opened this issue May 2, 2022 · 1 comment
Labels
discussion required requires a discussion before moving forward help wanted Intended for internal use for student workers recordedit

Comments

@RFSH
Copy link
Member

RFSH commented May 2, 2022

Description

As a temporary solution to support arrays, we decided to show a textarea for them a long time ago. With this textarea, users would have to write the whole raw value of the array. This means users would have to write [ and ] and wrap texts in ".

For example, assume the user wants to create an array of two string values. Then they would have to write the following:

[ "value1", "value2"]

As you can see, this is not user-friendly, and normal users would probably forget to wrap the texts. Therefore, we were thinking about relaxing this syntax and adding a transformation layer between what users write and what we send to the users. We need to write the relaxation rules and make sure they are backward compatible (users can continue to write arrays the old way as well as the new simpler method).

Details

To do this, we would have to change the array validator and the populateSubmissionRow logic.

We had a conversation about this, and the following are the changes that we would like to make:

  • The input should ignore the [, ], and any extra space around the values.
  • Newline (just like comma) should be treated as a value separator. If both are used, we should just add one separator.
  • Quotes should be optional. Quotes should be treated the same as a "grouping". For example, if you want to have a value in the array that has , in it, you could wrap it in quotes, e.g. "value1, value" should be treated as an array of length one.
  • A value like val\"ue can be valid or invalid depending on how we want to handle this. But "val\"ue" should be considered valid regardless.
  • The existing value in the edit mode,
    • Should not have the brackets or quotes.
    • Values should be separated with a newline.
  • Just like the markdown textarea, we should add "help" and "preview" buttons to the input. The "preview" button will ensure users are aware of what exactly is stored **What should it display? the formatted value in read-only mode? or the raw value? **.

P.S. I should mention that the described change is just a temporary solution to make the current implementation easier. And we should eventually add proper array support in recordedit

@RFSH RFSH added help wanted Intended for internal use for student workers recordedit investigation required Requires some initial investigation labels May 2, 2022
@RFSH RFSH added discussion required requires a discussion before moving forward help wanted Intended for internal use for student workers and removed help wanted Intended for internal use for student workers react-migration investigation required Requires some initial investigation labels Jun 7, 2023
@RFSH
Copy link
Member Author

RFSH commented Feb 1, 2024

I am going to close this issue as we're close to merging the proper array support (#2340), and this temporary solution is not needed anymore.

@RFSH RFSH closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion required requires a discussion before moving forward help wanted Intended for internal use for student workers recordedit
Projects
None yet
Development

No branches or pull requests

2 participants