Skip to content

Commit 175561a

Browse files
committed
Minor spelling, grammar, syntax, style fixes
1 parent dd28787 commit 175561a

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

docs/classic-ui/forms.md

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
---
22
myst:
33
html_meta:
4-
"description": ""
5-
"property=og:description": ""
6-
"property=og:title": ""
7-
"keywords": ""
4+
"description": "Create forms in Plone"
5+
"property=og:description": "Create forms in Plone"
6+
"property=og:title": "Create forms in Plone"
7+
"keywords": "Plone, forms"
88
---
99

1010
(classic-ui-forms-label)=
1111

1212
# Forms
1313

1414
```{todo}
15-
Describe how create forms with Plone's default form framework z3c.form.
16-
Fields, Widgets, Vocabularies aso are descripted in detail in there own chapter and will be referenced from examples here.
15+
Describe how create forms with Plone's default form framework `z3c.form`.
16+
{doc}`/backend/fields`, {doc}`/backend/widgets`, {doc}`/backend/vocabularies` are also described in detail in their own chapters, and will be referenced from examples here.
1717
```
1818

19-
Plone uses the [z3c.form](http://pythonhosted.org/z3c.form) library to build its web-forms.
20-
The packages responsible for integrating with Plone are [plone.z3cform](https://github.com/plone//plone.z3cform) and [plone.app.z3cform](https://github.com/plone/plone.app.z3cform) which contains most of the widgets and default templates. To simplify the process of organizing a form and specifying its widgets and fields, Plone utilizes [plone.autoform](https://github.com/plone/plone.autoform), in particular its `AutoExtensibleForm` base class. It is responsible for handling form hints and configuring z3c.form widgets and groups (fieldsets).
21-
22-
A form is a view that utilizes these libraries to auto generate forms.
19+
Plone uses the [`z3c.form`](https://z3cform.readthedocs.io/en/latest/) library to build its web forms.
20+
The packages responsible for integrating `z3c.form` with Plone are [`plone.z3cform`](https://github.com/plone/plone.z3cform) and [`plone.app.z3cform`](https://github.com/plone/plone.app.z3cform), which contain most of the widgets and default templates.
21+
To simplify the process of organizing a form and specifying its widgets and fields, Plone utilizes [`plone.autoform`](https://github.com/plone/plone.autoform), in particular its `AutoExtensibleForm` base class.
22+
It is responsible for handling form hints and configuring `z3c.form` widgets and groups (fieldsets).
2323

24+
A form is a view that uses these libraries to generate forms.
2425

2526

2627
(classic-ui-forms-general-forms-label)=
28+
2729
## General forms
2830

2931
The {term}`plonecli` provides you with an option to add a form to your Plone package.
30-
Given you have created an addon package with {term}`plonecli` called `collective.awesomeaddon`.
32+
Let's assume you created an add-on package with {term}`plonecli` called `collective.awesomeaddon`.
3133

3234
```shell
3335
cd collective.awesomeaddon
3436
plonecli add form
3537
```
3638

3739
After using the {term}`plonecli` to add a form, you'll have a new sub folder `forms` in your package.
38-
Here you will find a `configure.zcml` containing the registration of the form,
40+
Here you will find a `configure.zcml` containing the registration of the form.
3941

4042
```xml
4143
<!-- ZCML header and other ZCML here -->
@@ -49,7 +51,7 @@ Here you will find a `configure.zcml` containing the registration of the form,
4951
/>
5052
```
5153

52-
and a Python file with the code.
54+
And a Python file with the code.
5355

5456
```python
5557
from plone import schema
@@ -91,37 +93,41 @@ class MyForm(AutoExtensibleForm, form.EditForm):
9193

9294
@button.buttonAndHandler("Cancel")
9395
def handleCancel(self, action):
94-
"""User canceled. Redirect back to the front page.
96+
"""User cancelled. Redirect back to the front page.
9597
"""
96-
9798
```
9899

99-
Our form `MyForm` is a sub class of the z3c.form base class `z3c.form.form.EditForm` and `plone.autoform.form.AutoExtensibleForm` which add some convenient methods to organize the form fields and widgets.
100-
Besides some basic properties like `label` and `description`, the more interesting properties are `schema` and `ignoreContext`.
100+
Our form `MyForm` is a subclass of the `z3c.form` base class, `z3c.form.form.EditForm`, and `plone.autoform.form.AutoExtensibleForm`, which adds some convenient methods to organize the form fields and widgets.
101+
Besides some basic properties such as `label` and `description`, the more interesting properties are `schema` and `ignoreContext`.
102+
103+
104+
### Configure the form
105+
106+
In this section, you will configure the form's properties.
101107

102-
### configuring the form
103108

104-
#### schema
109+
#### `schema`
105110

106111
The schema property points to a schema interface, which defines the fields of our form.
107112

108-
```
113+
```python
109114
schema = IMyForm
110115
```
111116

112-
### ignoreContext
113117

114-
If your form is not bound to an object (like a Dexterity object), set `ignoreContext = True`.
118+
#### `ignoreContext`
119+
120+
If your form is not bound to an object (such as a Dexterity object), set `ignoreContext = True`.
115121

116122

117123
(classic-ui-forms-dexterity-add-edit-forms-label)=
118-
## Dexterity Add- and Edit forms
119124

120-
Dexterity content types are coming with default add and edit forms.
121-
You can build custom add and edit forms to adjust there behavior.
125+
## Dexterity add and edit forms
122126

123-
The implementation of the default edit and add forms is in [plone.dexterity.browser.edit.py](https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/browser/edit.py) and [plone.dexterity.browser.add.py](https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/browser/add.py).
127+
Dexterity content types come with default add and edit forms.
128+
You can build custom add and edit forms to adjust their behavior.
124129

130+
The implementation of the default edit and add forms is in [`plone.dexterity.browser.edit.py`](https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/browser/edit.py) and [`plone.dexterity.browser.add.py`](https://github.com/plone/plone.dexterity/blob/master/plone/dexterity/browser/add.py).
125131

126132
```{todo}
127133
Describe Add/Edit forms here and how to customize them.
@@ -131,7 +137,7 @@ Provide mutiple examples.
131137

132138
### Disable form tabbing
133139

134-
To disable the form tabbing, you have to override the edit and add forms and provide a property enable_form_tabbing which is False.
140+
To disable the form tabbing, you have to override the edit and add forms, and provide a property `enable_form_tabbing` as `False`.
135141

136142
The Python code `custom_forms.py` should look like this:
137143

@@ -172,11 +178,10 @@ class ICustomAddView(Interface):
172178
@implementer(ICustomAddView)
173179
class CustomAddView(add.DefaultAddView):
174180
form = CustomAddForm
175-
176181
```
177182

178-
to activate them, you have to override the registration of the forms for your desired content types.
179-
In your configure.zcml:
183+
To activate them, you must override the registration of the forms for your desired content types.
184+
In your `configure.zcml`:
180185

181186
```xml
182187
<configure
@@ -221,4 +226,3 @@ In your configure.zcml:
221226

222227
</configure>
223228
```
224-

0 commit comments

Comments
 (0)