I've created a survey form with an email address field that requires email address validation. When I enter a correct email address an submit the form everything works fine. However when I enter an incorrect email address, I get redirected to a HTTP 404 error (page not found) page. The url it attempts to open is the one below.
http://localhost/DfT/drupal/index.php?q=%3Cdiv+class%3D%22node%22%3E%0A+...
node/55 is my form page and node/53 is my "thank you" page to display once the form got submitted.
I investigated a bit and found that everything works as expected when I comment out the line below in function survey_response_submit in file survey.module.
return node_view($survey, FALSE, TRUE, TRUE);
I'm not sure if this breaks something else though.
Comments
Comment #1
reed.r commentedI also have this problem. There is more that seem broken maybe related to this.
When leaving "required" fields blank but writing an erroneuos email the form validation doesn't say anything about the email.
Writing your own valid_ function everything works out fine if things are returned TRUE otherwise you get one page of error messages which is a bit daunting.
Comment #2
reed.r commentedIt seems that the forms_validate function returns true even though it is not supposed to.
Comment #3
reed.r commentedIf I am correct in my hypothesis it is correct to comment out the return of survey_response_submit because hook_submit doesn't have a return value at least no in the api.
Comment #4
reed.r commentedSeems that I mixed up hook_submit with the forms api - "The return value of the _submit function will be the target of a drupal_goto; every form is redirected after a submit. If you return nothing, the form will simply be redirected to itself after a submit."
Question still remains why do the node_view return such a horrible answer??? Getting bald scratching my head at this.
Comment #5
gaele commentedThis error is still there as of 19 June 2007, and it's in 5.x-1.x-dev.
The problem is: the module returns the content of the node in the URL, instead of, well, the URL itself.
Comment #6
gaele commentedhttp://drupal.org/node/135838