========================
zeam.form.ztk uri widget
========================

Simple case
===========

Setup
-----

  >>> from zope import interface
  >>> from zope import schema
  >>> class ILink(interface.Interface):
  ...     uri = schema.URI(
  ...         title=u"uri")


  >>> class Link(object):
  ...     pass
  >>> content = Link()

  >>> from zope.publisher.browser import TestRequest
  >>> request = TestRequest()

Field
-----

So now you can create a field, and get a choice field::

  >>> from zeam.form.base import Fields, Field

  >>> fields = Fields(ILink)

If we want to use a radio widget instead of the default selection widget
we have to change the default mode for our field to radio::
You can do this easily in the update method of your form.

  >>> URIField = fields.get('uri')
  >>> URIField.mode
  <Marker DEFAULT>

Widget
------

You have an associated widget::

  >>> from zeam.form.ztk import Widgets, FormData

  >>> Form = FormData(content, request)
  >>> Form.ignoreContent = False

  >>> URIWidgets = Widgets(
  ...     fields,
  ...     form=Form,
  ...     request=request)

  >>> URIWidgets.update()

  >>> URIWidget = URIWidgets['form.field.uri']
  >>> URIWidget
  <URIWidget uri>

  >>> print URIWidget.render() #doctest: +NORMALIZE_WHITESPACE 
  <input type="url" value="" id="form-field-uri" class="field field-uri field-required"
      name="form.field.uri" required="required" />
