Forums

Validate specific radio buttons in a group

arkmedia 11 Dec, 2008
Hey Guys-

I have a quiz on my site that I need to validate one specific answer in a group of radio buttons. As far as I know, ChronoForms only gives the ability to validate whether at least one radio button was chosen, well I need to validate that a specific answer was chosen and still keep the buttons in groups. Right now, I have all the buttons named differently so users could just check all of the answers and have it go through. I am not great with JS, so I was hoping someone might be able to help me with the code, I have found the mooValidation.js file and I know where to put it, I just need to know the specific code for validating specific buttons within a group.

Thanks!
Max_admin 12 Dec, 2008
Hi arkmedia,

I think in this case you need to use your own custom JS code, its not very hard to write! you can find many examples online!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 12 Dec, 2008
Hi arkmedia,

If you use the moo-validation code you could make one button 'required' but then a validation error message will show up if they tick the wrong box which kind of defeats the purpose of a quiz.

Bob
GreyHead 24 Dec, 2008
Hi lasreru,

You need to make some small changes to your Quiz code. In line 29 of quizconfig.js there is the line
 var thequestion=eval("document.myquiz.question"+q)
. In ChronoForms your form is now called ChronoContact_course1quiz so this line has to be changed to
 var thequestion=eval("document.ChronoContact_course1quiz.question"+q)


I notice that there's also a reference to your old site url in there as well and possibly some other changes that I didn't spot.

Bob
This topic is locked and no more replies can be posted.