in reply to Loop through params and dynamically create a table

I've built some surveys like what you are talking about.

You might want to consider that it may be edited often, and save the version number so that people who took an older version can later take it again instead of being penalized.

Also you could have fields/choices with the same name, what we did is start out with the concept of a hierarchical survey. You could concatenate section, subsection, question, and choice to get field names but they would be very long. Some kind of editor (XML?) or just an INI style file might be helpful.

Incidentally I looked at a module in CPAN called INIFiles which I didn't like and rolled my own on another project. But DBD::RAM seems to read/write INI files so maybe you could use that. Maybe you'd rather make your own file format.

Making the HTML was a major pain, and I was constantly editing it. If you can have CGI.pm or something else build the form for you programmatically you will find this much more enjoyable. If that plus maybe a design template is satisfactory, then abstracting it out (using a text file or inline code to describe the system, instead of using html to do so) would be I think, for me anyway, easier in the long run.

Finally if it was me, I would make a separate db initialization script which like the main enquete script uses a config.pm module. You would just edit that module and run the init script once. Also I'd recommend a telnetable account for your mysql box, so limiting the permissions of that init script to the account owner will increase security and not cost much time. You can use the command line client mysql to check the db quickly.

I think the biggest things to worry about in this project are
1) editing, which you've been thinking about; and
2) corrupting data, or wrongly attributing data to another user or to the wrong skill of the same user. Since it is going to be hard to get people to take the same exact test over again, you should keep a log. Mysql itself has one which you can enable, but something which looks like a filled out form might be more useful. To ensure that everything is correct though, you might want to show a confirmation page and allow a person to go back (just use javascript button to go -1 in the history). Lastly,
3) actually getting people to respond. You need to keep it as short as possible and if possible get someone at each location to adminster the quiz or remind people to take it. Maybe you have a personnel list so you can send email to each person, but this is key. No data, no joy!

Have fun!

  • Comment on Re: Loop through params and dynamically create a table