.. -*-doctest-*-

================
Integer Criteria
================

The SimpleIntFormCriterion is provided for rendering integer search
widgets on the search form.

We start with a topic.

    >>> foo_topic = self.folder['foo-topic-title']

Open a browser as an anonymous user.

    >>> from Products.Five.testbrowser import Browser
    >>> from Products.PloneTestCase import ptc
    >>> browser = Browser()
    >>> browser.handleErrors = False

Add a list criterion for the subject/keywords.

    >>> foo_topic.addCriterion(
    ...     'getObjPositionInParent', 'SimpleIntFormCriterion')
    <SimpleIntFormCriterion at
    /plone/Members/test_user_1_/foo-topic-title/crit__getObjPositionInParent_SimpleIntFormCriterion>

Designate the criterion's field as a form field.

    >>> crit = foo_topic.getCriterion(
    ...     'getObjPositionInParent_SimpleIntFormCriterion')
    >>> crit.setFormFields(['value', 'value2', 'direction'])

When viewing the collection in a browser the fields will be rendered.

    >>> browser.open(foo_topic.absolute_url())
    >>> browser.getControl('Order in folder')
    <Control
    name='form_crit__getObjPositionInParent_SimpleIntFormCriterion_value'
    type='text'>

Also note that criteria that use a 'value' field as the primary search
value do not render the label for the value field as it would be
redundant.

    >>> '>Value</label>' in browser.contents
    False
    >>> ('form_crit__getObjPositionInParent_SimpleIntFormCriterion_value_help'
    ...  in browser.contents)
    False
