[FIX] Can't Create Form Without Selecting Group

Kaylakaze

New Member
I don't know if anyone else has this problem, but just figured I'd post my solution.

You'd think, if you select "Create a group with the same name as this form" when creating a form, that you wouldn't be required to then select a group, especially since the word "Or" is in there, but due to a bad JavaScript check, the system doesn't check the value of that button and just assumes that if your group list is empty, it's invalid. Here's how to fix the JavaScript.

In file \administrator\components\com_fabrik\views\form\tmpl\bootstrap.php:
After
Code:
var currentGroups = document.id('jform_current_groups');
add
Code:
var createNew = jQuery('input[name="jform\\[_createGroup\\]"]:checked').val();
and a few lines down, replace
Code:
if (typeOf(currentGroups) !== 'null' && currentGroups.options.length === 0) {
with
Code:
if (typeOf(currentGroups) !== 'null' && currentGroups.options.length === 0 && createNew != 1) {

This seems to do the trick.
 
Makes sense. We'll need a non jQuery way of getting the createNew status (as this code has to run on J! 2.5 as well, which may or may not have jQuery loaded), but the logic is sound.

I'll get that fixed ASAP.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top