Input Requried - check box group. How is it coded?

NickOg 21 May, 2014
I have a rather complicated form that includes a check box group. Well, at least, some of the code generating that table is complicated.
[attachment=0]4Bob00.jpg[/attachment]
I can't work out how to build it with the simple check box group controls. I have written a PHP script to generate the table and have included that via a custom code control, using code generated by ChronoForms as a model.

My problem is that, using this technique, Ii can't make the validation 'required' work. Is it possible to modify my script to access the (presumably javascript or mootools) functions that chronoforms uses to force validation required?

I hope this makes sense.

Regards

Nick
NickOg 21 May, 2014
Eureka! - went back to the generated code and worked it out. ๐Ÿค”
In case anyone else has the same problem, the relevant code is
Once line per form
<input type="hidden" name="inpPickedCourses" value="" alt="ghost" />

and then for the check boxes
<input type="checkbox" name="inpPickedCourses[]" id="inppickedcourses_0" title="" value="choice 1" class="validate['group[1]']" />
<label for="inppickedcourses_0">Choice 1</label>
<input type="checkbox" name="inpPickedCourses[]" id="inppickedcourses_1" title="" value="choice 2" class="validate['group[1]']" />
<label for="inppickedcourses_1">Choice 2</label>
<input type="checkbox" name="inpPickedCourses[]" id="inppickedcourses_2" title="" value="choice 3" class="validate['group[1]']" />


I am not quite sure where the '1' in
 class="validate['group[1]']
comes from - I assumed the sequence number of a group on a form but it doesn't seem to be that.

Nick
NickOg 22 May, 2014
What is the opposite of Eureka? ๐Ÿ˜ถ ๐Ÿ˜ถ
I swear that worked before lunch, It doesn't now and I can't make it. Back to the drawing board and see if I can build the controls in place on a form.

๐Ÿ™„
Nick
Max_admin 22 May, 2014
Hi Nick,

The "1" is the group identifier, so a group of checkboxes with
validate['group[1]']
will be checked together for at least 1 checked box, a 2nd parameter may increase the limit:
validate['group[1,5]']

You may also change the "1" to assign a checkbox for a different validation group!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NickOg 22 May, 2014
Hi Max

Thanks for that. I will have another shot and my first attempt.

Nick
NickOg 22 May, 2014
Still stuck. The code to generate the check box group works fine as per figure included. But I just can't get the validate required to work.
If I include a group check box directly in the form that works fine. If I generate the control using stuff like
 <input type="hidden" name="inpPickedCourses" alt="ghost" value=""/>
foreach ($courseData as $thisCourseRecord) {
....
?>
<input type="checkbox"  name="inpPickedCourses[]" <?php echo $allowBooking; ?> class="validate['inpPickedCourses[32]]']"
id="inppickedcourses_<?php echo $courseID; ?>" title=""  value="<?php echo $thisCourseRecord["idCourse"]; ?>"
class="validate['group[32]']" />
<?php
....
}

then it refuses to validate required on that control or any others added by the wizard to that form.

I suspect that it is because the group number isn't right. I used 32 because the control I added with the wizard was 31. That didn't work so I guessed that after deleting that control it would be 32.

any ideas? Can I find out what the group number is after the first
 <input type="hidden" name="inpPickedCourses" alt="ghost" value=""/>
call?

Nick :?
Max_admin 23 May, 2014
Answer
Hi Nick,

You have 2 class attributes, this is wrong:
class="validate['inpPickedCourses[32]]']"


Please remove it and try again, the number can be any integer, it doesn't matter!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NickOg 23 May, 2014
Doh! Thanks Max - all up and running now.
NickOg 24 May, 2014
Hi Max
My problem now is a but difficult to describe.

I needed to remove a radio box from this form so that the only control on the page is that table described, generated via a PHP script. The thing is that once the radio box has been deleted the validation required for the control generated by the PHP script no longer works. It works fine with the (now redundant) control in place but not without it.

If I add a radio box back into the form then validation of my code works as long as the new radio box has validation required enabled.

Does that make sense? Do you have any suggestions?

Regards

Nick
Max_admin 25 May, 2014
Hi Nick,

Please post the html code for the checkboxes and the radio box!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
NickOg 25 May, 2014
Yes!! That is the one Bob. Thanks a lot. A great way to start my day.
Max, I won't bother you with the files.

Terrific

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