Thanks.
How do you think it could work?
Here are some ideas I have, though they still have some questions to answer:
Basics that are there now: Placeholders. But right now its "all or nothing"
The simplest structure I can think of to mimic form behavior would be where the “form” comes up in the editor (the “d-editor” that comes up when you hit create topic
).
In that editor, you could provide different “sections”, like:
Name
Location
Issue
Each section title would be a placeholder, so when the user would click on it, the title (e.g., Name) would disappear.
So far, setting this up is possible with the placeholder text theme component.
But–that won’t quite get you there for form-like behavior, because the placeholders that are there now appear “all or nothing”, like I describe next.
Form-like behavior with placeholders. But how do you access divs in the editor?
To make this more like a form, each section has to behave independently.
Right now, with the placeholder text theme component, it’s all or nothing–if the user clicks on the editor, all of the placeholder titles disappear.
So, to have basic form behavior, instead of having all titles either appear or disappear, we’d need to have each placeholder title section behave independently. So when the user clicks on the placeholder “Name”, only that placeholder disappears, while the other placeholders (“Location” and “Issue”) stay.
That would be possible if each placeholder could be part of its own div with unique id within the text editor. Then, with jquery, you could show and hide the placeholder depending on if the user clicked in the area. That requires adding separate divs within what is now a textarea, which I am not sure how to do.
Question for this approach: How can you access divs within the editor’s textarea, so that you can take action when user clicks on them?
Alternative: using the existing template text option. But how to make the text not editable?
Probably an alternative would be that the section headers don’t “disappear” when the user clicks. So the section headers (example: Name, Location, and Issue) would be text that would stay on the page. To make it more form-like, compared to the current basic topic template default:
- The section header text could not be edited by the user (ie,
contenteditable="false"
)
- The section break points could not be removed by the user
- There would be space below the section header where it’s clear the user can type. In the current default template, they’d have to go to where the text is, hit
return
, to create space to type.
Question for this approach: How can you enter template text, but (i) have that text be not editable by the user and (ii) have clear places for the user to enter information below each piece of text?
Maybe there is a better way to get at form-like behavior?