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

xolotl’s picture

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.

Alex Reisner’s picture

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
dtan’s picture

StatusFileSize
new875 bytes

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

dtan’s picture

StatusFileSize
new875 bytes

html was added to previous patch. . .

jasonwhat’s picture

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

urbanfalcon’s picture

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.

gollyg’s picture

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

walkah’s picture

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

walkah’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)