Download & Extend

Survey information lost when form is validated

Project:Survey
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

When the user submits a survey and the survery does not pass validation then all the values in the form are reset when the page reloads. You can test this at http://drumbeatinsight.com/contactus. Enter values in all the fields except one required field and submit the form. When the page reloads the error message appears but all the form values are empty.

Comments

#1

This issue still exists in latest CVS version as of 4/20/2005. Requiring fields but not reloading existing data on error is a serious usability issue.

#2

I apologize for not having time to write a patch, but this problem is caused by the survey being submitted to node/submit/x and then the redirection to node/x if there's an error (you can see this in survey_submit()) which loses the POSTed data. To fix the problem I made surveys submit to their base path (ie, node/x instead of node/submit/x). This requires modifying:

  • survey_menu() should respond differently to path node/x if there is $_POST['edit'] data
  • survey_submit() should not redirect on an error but instead re-print the survey

#3

This patch should do the trick. It simply reloads the view if an error occurs.

AttachmentSize
survey.module.validate.patch 875 bytes

#4

html was added to previous patch. . .

AttachmentSize
survey_module_validate.patch 875 bytes

#5

Was this added to the module? If so, what version?

#6

As of September 19th, this had not been included with the core module, but I really think it's a necessity. In fact, on top of the proposed addition, I would suggest also editing the _menu so that

$items[] = array('path' => 'survey/submit', 'title' => t('survey submission'),

becomes

$items[] = array('path' => 'survey/submit', 'title' => t('please complete survey submission'),

Aside from that, it seems to perform as advertised.

#7

Seems that the patch works, but the reloaded page no longer has a title - these fields appear blank. This is occuring when the survey is set to form part of a book hierarchy, don't know if it happens using regular taxonomy node

#8

committed to both HEAD and DRUPAL-4-6. thanks ! :)

#9

Status:needs review» fixed

#10

Status:fixed» closed (fixed)