Create Form-like Content in a Notebook
Form notebooks—structured, form-like content in Wolfram Notebooks—have a WYSIWYG-like authoring environment, optimized for inserting form elements and open coding areas to be later scraped into an Association.
Open a new form authoring notebook
Open a new form authoring notebook by selecting it from File ▶ New ▶ Programmatic Notebook ▶ Form Notebook Authoring:
- Alternatively, you can open a new form authoring notebook programmatically using CreateNotebook["FormNotebookAuthoring"].
Add an input field form element
Add an input field from Insert ▶ Form Element ▶ Input Field:
Customize the form element
In template view, edit the information, then select Confirm to finalize the changes:
Examine the information in code view to see the raw FormObject:
Use preview to examine how the information will look in a WYSIWYG fashion before generating the form notebook:
Add a key to the form element
Create a Key for the input fields so that you can grab necessary information programmatically:
- Generally, keys are used to lump certain form elements together across notebooks for easy tabulation, e.g. a teacher grading a quiz and comparing solutions to their real values.
- Keys are restricted to plain text characters.
- Only contents associated with a Key in the authoring notebook will be scraped.
Add an editable notebook area form element
Editable notebook areas let end users execute code in the generated form notebook. Add one to the authoring notebook with Insert ▶ Editable Notebook Area:
Add content to the editable notebook area and edit the key:
- Editable notebook areas will scrape all cells entered within them and return raw cell expressions. It is up to the author to further parse this for the necessary data.
Open the settings and modify them for your needs:
- You can add or remove submission timestamps from all keys using the checkbox in Settings.
- For more information on creating custom submission actions, see Customize the Behavior of Form Notebook Submission.
Generate the Form Notebook
Select Generate to create the form notebook:
- All authoring-only elements will be removed after generation.
Fill out and submit the notebook
Using the generated form notebook, fill out the information and submit the form:
The submission is set to CreateDocument, which will output an Association with the relevant form notebook information in a new document:
- CreateDocument is the default submission type.
- You can change submission types in the settings dialog from a previous step.