@@ -211,8 +211,7 @@ Before that, the `groups` attribute is just a list of group factories.
211211During the update method though, the groups have been initialized and have their own widget list each.
212212To access widgets in a group, you have to access the group in the update method:
213213
214- ``` {code-block} python
215- :linenos:
214+ ``` python
216215
217216from z3c.form import form
218217
@@ -231,8 +230,7 @@ class MyForm(form.Form):
231230You can customize widget options in the ` updateWidgets() ` method.
232231Note that ` fieldset ` (which is a group) is a ` subform ` , and this method only affects the current ` fieldset ` .
233232
234- ``` {code-block} python
235- :linenos:
233+ ``` python
236234
237235from z3c.form import form
238236
@@ -254,8 +252,7 @@ class MyForm(form.Form):
254252
255253With ` plone.z3cform ` , you can reorder the field widgets by overriding the ` update() ` method of the form class.
256254
257- ``` {code-block} python
258- :linenos:
255+ ``` python
259256
260257from z3c.form import form
261258from z3c.form.interfaces import HIDDEN_MODE
@@ -277,8 +274,7 @@ class MyForm(form.Form):
277274
278275You also can use ` plone.autoform ` directives, as in this example used for forms:
279276
280- ``` {code-block} python
281- :linenos:
277+ ``` python
282278
283279from plone.autoform import directives as form
284280from z3c.form.interfaces import IAddForm, IEditForm
@@ -308,8 +304,7 @@ class IFlexibleContent(form.Schema):
308304Sometimes you need to pre-load widget values to show when the form is requested.
309305The following example shows how to do that.
310306
311- ``` {code-block} python
312- :linenos:
307+ ``` python
313308
314309from z3c.form import field
315310from z3c.form import form
@@ -350,8 +345,7 @@ This will result in a checked option value of `02`.
350345
351346The following example shows how you can conditionally require widgets.
352347
353- ``` {code-block} python
354- :linenos:
348+ ``` python
355349
356350class ReportForm (form .Form ):
357351 """ A form to output an HTML report from chosen parameters """
@@ -370,16 +364,14 @@ class ReportForm(form.Form):
370364To add CSS classes to a widget, you can use the method ` addClass() ` .
371365This is useful when you have JavaScript associated with your form:
372366
373- ``` {code-block} python
374- :linenos:
367+ ``` python
375368
376369widget.addClass(" myspecialwidgetclass" )
377370```
378371
379372You can also override the widget CSS class by changing the ` klass ` attribute for a given widget:
380373
381- ``` {code-block} python
382- :linenos:
374+ ``` python
383375
384376self .widgets[" my_widget" ].klass = " my-custom-css-class"
385377```
@@ -468,8 +460,7 @@ The following code is an example of a custom template `yourwidget.pt` for an `in
468460
469461Now you can override the template factory in the ` updateWidgets() ` method of your form class.
470462
471- ``` {code-block} python
472- :linenos:
463+ ``` python
473464
474465from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile as Z3ViewPageTemplateFile
475466from z3c.form.interfaces import INPUT_MODE
@@ -545,8 +536,7 @@ Remember to fix the path of the template according to your own paths.
545536
546537Then create a new marker interface in Python code.
547538
548- ``` {code-block} python
549- :linenos:
539+ ``` python
550540
551541from zope.interface import Interface
552542
@@ -557,8 +547,7 @@ class IDemoWidget(Interface):
557547
558548Then apply this marker interface to your widgets in ` form.update() ` .
559549
560- ``` {code-block} python
561- :linenos:
550+ ``` python
562551
563552from zope.interface import alsoProvides
564553
@@ -578,8 +567,7 @@ You can combine several widgets into one with `z3c.form.browser.multil.MultiWidg
578567
579568The following example shows how to create an input widget with minimum and maximum values.
580569
581- ``` {code-block} python
582- :linenos:
570+ ``` python
583571
584572import zope.interface
585573import zope.schema
0 commit comments