Friday, August 12, 2011

Jomsocial checkbox, radio buttons tooltip & validation bugs & solution

Have Joomla site?
Installed Jomsocial Component?
Created checkboxes or radio buttons using custom fields?
Suffering from checkboxes & radio buttions tooptip & Validatation of these fields wokring after submitting form(basically functionality should be to have alertbx with error message like other inputs). Then you must read this post & follow all the steps.

These are the Jomsocial bugs. You can find these bugs in latest verison(2.2.4) also don't know why these guys haven't sorted out yet. We were suffering from this problem for 2Lush cru site. We told client its Jomsocial bug but as usual, he was not ready to accept & told to do whatever to solve these issues. I know, this issue was in PMS from last 1-2 months no one was able to solve it.

If you want to sort out these bugs the you need to hack the jomsocial files cause you can't override these files which you need modified. Dont worry it won't affect your jomsocial at all.

To remove empty tooltips from check box fields.
go to file components/com_community/libraries/fields/checkbox.php
line no. 36
$cclass = ($field->required == 1) ? ' required validate-custom-checkbox' : '';
line no. 60
Change only class name
$html .= 'input type="checkbox" name="field' . $field->id . '[]" value="' .
$option . '"' . $selected . ' class="checkbox '.$class.'" style="margin: 0 5px
5px 0;" />';
change to
$html .= 'input type="checkbox" name="field' . $field->id . '[]" value="' .
$option . '"' . $selected . ' class="checkbox '.$cclass.'" style="margin: 0 5px
5px 0;" />';

Validation of checkbox
line no. 44
$class = !empty( $field->tips ) ? 'jomTips tipRight' : '';
change to
$class .= !empty( $field->tips ) ? ' jomTips tipRight' : '';
public_html/components/com_community/libraries/fields/radio.php

Same for radio button validation
go to the file components/com_community/libraries/fields/radio.php
Just update file as above.