Submitting a formlib generated form appears to do something, but doesn't

Bug #186475 reported by Reed O'Brien
2
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Undecided
Unassigned
zope.formlib
Invalid
Undecided
Unassigned

Bug Description

When a form is generated with formlib I can click Save and it saves, or Cancel and it cancels. But if you hit enter it seems to submit and the page reloads with the new value in the changed form field, but it doesn't actually save it or alert you that nothing was changed. This is misleading. We believe hitting Enter should save the field just like clicking a Save button.

I am not sure if this is the best solution, but it seems to be working for us, this far (Not yet in production use).

*** zope/formlib/form.py Mon Oct 29 09:12:54 2007
--- zope/formlib/form.py Sun Jan 27 18:49:18 2008
***************
*** 598,603 ****
--- 598,606 ----
              return self.failure_handler(self.form, self, data, errors)

      def submitted(self):
+ if self.form.request.environ['REQUEST_METHOD'] == 'POST'\
+ and not [k for k in self.form.request.form if k.startswith('form.actions.')]:
+ self.form.request.form[u'form.actions.save'] = u'Save'
          return (self.__name__ in self.form.request.form) and self.available()

      def update(self):

description: updated
Tres Seaver (tseaver)
Changed in zope3:
status: New → Won't Fix
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope.formlib project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope.formlib.

Changed in zope.formlib:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.