Situation: we need to implement a staff member content-type in Dexerity where one field of the content-types represents the user in LDAP (through its DN). For the user prospective:
- user enters a query into the search field
- an ajax search performs a search in LDAP and returns a list of candidate where each
candidate is tuple (DN, fullname of person).
So is there a reasonable widget for z3c.form/Dexterity that supports an AJAX search and the storage of DN + fullname?
The AjaxSelectFieldWidget is not working well here:
- it defines a 1:N relation (not 1:1, could be check with @invariant but ugly)
- the specified vocabulary must be dynamic and it must be searchable (I made a SimpleVocabulary
search()able with a subclass)
- a dynamic vocabulary does not work properly in case of validation errors or when the content-type
is in the add-phase and not persisted yet. In this case you need to pick up the related values from the
request and construct a vocabulary on-the-fly in order to render the widget properly.
- the code above leads to "Wrong contained type" validation error.
directives.widget('idm_link2', AjaxSelectFieldWidget, vocabulary='unimr.staff.persons.idmlink') idm_link2 = schema.List( title=_(u'Person IDM Link'), value_type=schema.Choice( title=u'Dummy', vocabulary='unimr.staff.persons.idmlink'), required=True )