plone - non required SelectFieldWidget -


I have an expertise content type and I have to put a selected field that is not necessary and which value is a term

This is the glossary. Pre- @ grok.provider (IContextSourceBinder) Def voc_test (reference): value = range (10, 21) conditions = map (Lambda X: simple trim (value = str (x), title = str (X)), values ​​back to simple terminology (word)

and the definition of this area:

 import  dexterity from plone.directives, zope Import schema class from plony.namefile.field from IMyType (form.Schema) form from NamedImage: ... form.widget ('test', selectFieldWidget) test = schema list (title = _ (U "test"), value_type = Schema The option (source = glossary. Voc_test), description = _ (u "desc_test"), required = false,)   

What I find is a select field with my values ​​and terminology The value is 'no value' before it is okay. But when I save an error message selected and the 'no value' hit amount is shown:

  Traceback (Last Last): module In ZPublisher.Publish, line 138, published module ZPublisher.mapply, line 77, mapply module in ZPublisher. Plone.z3cform.layout in the Publish, line 48, call_object module, line 66, __call__ module plone.z3cform.layout, in line 50, plone.dexterity.browser.edit, line 52 in the update module, update module plone.z3cform.fieldsets In .extensible, line 59, update module plone.z3cform.patch, line 30, z3c.form.group in GroupForm_update module, line 145, update module in plone.app.z3cform.csrf, module z3c.form in line 21. Action, execution on line 98, execute in module z3c.form.button, line 315, __call__ module z3c.form.button, line 170, __call__ module plone.dexterity.browser.edit, line 23, handleAp Ply module z3c.form.group, line 98, extractData module in z3c.form.form, line 147, extractData module in z3c.form.field, line 303, Extract module in z3c.form.converter, in line 316, toFieldValue module Z3c.form.term, line 41, getValue module in z3c.form.term, line 38, getTermByToken module in zope.schema.vocabulary, 133 line, getTermByToken LookupError in: --NOVALUE--   

If I change:

  required = false,   

to

  required = true   

Savings work.

Hope someone can help, thank you.

Set a default that is within your vocabulary and the field is required so that "--NOVALUE - "Is not in the alternative.

If, for some reason, you want to use "- NOVALUE -" for that default, then add it to glossary if the field set is required, it will not be duplicated.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -