[Zope3-Users] Maintaining data fields on form edit

mats.nordgren mats at ronin-group.org
Thu May 25 15:09:33 EDT 2006


This seems to work

class EditForm(form.EditForm):
  form_fields = form.Fields(ISchema)

  def __init__(self, context, request):
    self.context, self.request = context, request

  @form.action('Edit')
  def handle_edit_action(self, action, data):
    if data['image'] != None:
      self.context.image = data['image']
    # continue adding values to context for other fields


Cheers,

Mats 
    

On Wed, 24 May 2006 22:46:37 +0100, Graham Stratton wrote
> I'm using formlib to create an edit form for a schema which contains 
> a bytes field (an image).  When the form is submitted, I don't want 
> the image to be removed if no new image is uploaded.  I can't see a 
> simple way to achieve this, but I'm hoping I'm missing something.
> 
> Many thanks,
> 
> Graham
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users



More information about the Zope3-users mailing list