Hello!

Is it possible to create quiz fields with CCK? I have a special content type and I need to attach a quiz to that but I don't want to use another module because the whole thing needs to be handled as one content type. I'd like to have let's say 20 questions with 4 possible answers each, one of them will be tagged as right answer, the rest will be the wrong answers obviusly. Is this possible to do somehow?

Thanks in advance!

cr

CommentFileSizeAuthor
#3 cck_quiz.zip1.63 KBrvarkonyi

Comments

summit’s picture

Subscribing, greetings, Martijn

karens’s picture

Status: Active » Fixed

You'd probably be better off using something like the webform module for this. There may be ways to 'trick' CCK into working, but it definitely isn't set up to do this out of the box.

rvarkonyi’s picture

Status: Fixed » Active
StatusFileSize
new1.63 KB

Hey guys,

ok so I made a lot of research and found a very good CCK tutorial about creating a new field type. I used that as a base for the CCK Quiz fields.

Please note a few things:

1) the code is NOT 100% beautiful, although I tried to make it as clean as I could (I'm not a programmer), so there can be some unnecessary things in it that originally came from the source code of the above mentioned tutorial. Any suggestions or tips are welcome.

2) in my case the only thing needed was to create quiz-type form elements and automatically convert and export the entered values into XML (made it using workflow-ng custom php code), that means that this module will only give you the ability to display: a) a textarea for the question you want to enter b) 4 textfields for the 4 answers c) 4 radio buttons for you to choose which answer is the correct one. So in my case it was built for a really specific need, but maybe someone can use it as a base or with a little more work we could even publish it as a contribution.

Any feedback is really welcome!

summit’s picture

Hi Robert,

Thanks a lot for your code.
Does this work together with the quiz module (www.drupal.org/project/quiz) ?
What the quiz module is still missing is the short answer/open answer possibility, may be possible through cck also?

Greetings,
Martijn

karens’s picture

Status: Active » Fixed

The problem is this module (and any such module) does a very limited set of things (ask a text question with four possible text answers). Creating things like quizzes and surveys needs more flexibility than that, plus it is only partly about creating a flexible form, it's also about creating a back end to process the results.

There are a couple projects that are working on this, mentioned above, http://drupal.org/project/webform and http://drupal.org/project/quiz. I think working on improving those solutions would make more sense than adding a basic, extremely limited, quiz module to CCK.

rvarkonyi’s picture

Status: Fixed » Closed (fixed)

Hello KarenS,

I totally know that this module is "extremely limited". If you read back my original post you know what was the functionality I was looking for. I couldn't find an existing solution, that's why I created this module in order to solve my problems. I bookmarked this topic and now that I checked back a few months later I saw that there was some kind of interest in it. That's why I replied and knowing that my solution is very limited to the problem I had, I made sure I highlight a few things about it before submitting the files, such as "in my case the only thing needed was to create quiz-type form elements and automatically convert and export the entered values into XML (made it using workflow-ng custom php code), that means that this module will only give you the ability to display: a) a textarea for the question you want to enter b) 4 textfields for the 4 answers c) 4 radio buttons for you to choose which answer is the correct one. So in my case it was built for a really specific need, but maybe someone can use it as a base ..."

I appreciate your feedback btw, but I told you what this module does and I don't understand why are you surprised that it doesn't do more than that... OK man, let's not call it a module then. Call it a try of not a professional coder like yourself, who thought his solution might be useful to someone struggling with a similar problem.

Rob

karens’s picture

You've got this posted in the CCK issue queue. This issue queue is a place to report problems with the module or request new features or supply patches. What you want to do is something different, you want to provide a place to discuss creating some custom code that is not a part of CCK.

I marked it 'fixed' because we can't keep issues open for things like this or we'll have no way to identify the things in the issue queue that we need to address. A 'support request' means it is something we're expected to reply to, and we did that. A 'feature request' means it is something that might be added to the code, and we leave it open if we agree it would be a good addition. We try hard to close as many issues as possible so we keep this issue queue manageable.

To do what you want to do, hash out ways to create a new module, you can either go to groups.drupal.org and post this in the CCK group, or you can find the 'CCK snippets' page in the CCK handbook and add this there. In either of those places you can leave it open and have as much discussion as you want.

karens’s picture

And the comment about 'extremely limited' was because I thought maybe you were proposing that we should make this a part of CCK, to make it clear why it wouldn't be. But I also said it because I want to point out it might not make sense to try to re-invent the wheel when there are other modules that have spent a lot of time working those things out.

But if you want to do it as an exercise in learning how to code, or because you have a very limited need that it would meet, that's up to you.