formbuilder icon indicating copy to clipboard operation
formbuilder copied to clipboard

Add a way to add paragraph of text

Open almet opened this issue 9 years ago • 8 comments

Sometimes, it can be useful to have a paragraph of text in addition to the different inputs.

almet avatar Feb 22 '16 09:02 almet

I would love to have @n1k0 input on this one. It seems to me that JSON Schema doesn't support custom paragraph of text, especially because that's not defining an input.

Where would you put such information?

almet avatar Apr 15 '16 21:04 almet

especially because that's not defining an input.

JSON Schema doesn't define inputs but data structures, and a string is a perfectly valid one. So we need to find a way to identify string fields dedicated to representing paragraphs of text in the schemas consumed by the formbuilder.

We could establish a kind of convention, eg. if any object field name is prefixed with some identified pattern, we know we have to use it as a static paragraph of text; and the good news is that schemas can have a description attribute which seems like a good place to store the actual text of that paragraph.

Now our custom SchemaField obviously needs to intercept object fields named that way to simply render a paragraph of text instead of a standard StringField.

Does that make sense?

n1k0 avatar Apr 15 '16 21:04 n1k0

That makes a lot of sense, yes! Thanks :)

almet avatar Apr 15 '16 21:04 almet

I would go for @n1k0 solution using the placeholder value of the StringField to store the value of the Paragraph.

Natim avatar May 23 '16 13:05 Natim

Related to https://github.com/mozilla-services/react-jsonschema-form/pull/213

almet avatar May 24 '16 14:05 almet

After thinking more about this, and after a conversation with @n1k0 it seems that Widgets already offer a way to include some text, for instance a hint just after the display of the input.

Rather than adding a specific "paragraph" widget, it would make sense to allow editing this "hint" location from inside the formbuilder.

almet avatar May 26 '16 13:05 almet

Yes the ui:help thing?

Natim avatar May 26 '16 13:05 Natim

Yes exactly!

almet avatar May 26 '16 13:05 almet