Allow custom layouts in surveys
| Project: | Survey |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I needed to be able to use more flexible survey layouts than what the module allows by default, so I patched my install to add a "layout" textarea to the "fields" tab that lets you specify markup for displaying form fields. You plug form fields into the markup by using id-based placeholders (e.g. {22} for form field 22). The patch includes the following fixes:
- Add field id display for reference to the first column of field display.
- Add layout textarea to field display
- Add code to handle saving layout
- Add field to database to contain layout
- Add new form callback that breaks the layout into chunks on {\d*} markers and adds chunks as #prefix and #suffix attributes as appropriate to modify the form display
- Add new _submit function to accompany form callback that just forwards results to the original _submit function.
- Make survey_view call the new callback if $node->layout isn't empty.
I think that's it. Seems to work pretty well on my install, and I thought I'd share it for the benefit of others.
| Attachment | Size |
|---|---|
| survey.module.layout.patch | 5.51 KB |

#1
Survey module is no longer being maintained, use Webform module instead.
---Closing down issue queue of survey module---