Forums

problem with formCheck (.register & .dispose)

Matten 03 Mar, 2014
Hello (again),

In my form I have a check box (cb1) that when checked shows there under an additional checkbox group which is set in the backend (advanced wizard) to required (so at least one option must be checked).
As soon as this first check box (cb1) is checked, the check box group is shown (through some simple in the "load JS" action).

What I want to obtain now is that upon submitting the form, the check box group is only taken into consideration for the "required checking" when that first check box (cb1) is checked.

I've been reading a whole lot so far in an attempt to solve this myself and found the following thread here which seems to perfectly address what I want:
http://www.chronoengine.com/forums/posts/f2/t87951/if-ja-next-field-should-be-rquiered.html?hilit=formcheck

So I thought this would be pretty clear & simple (the thread is for one)
but when I get to it and use formCheck_<my form name>.register or .dispose it tells me that formCheck_<my form name> is not defined?

Am I forgetting something somehow/somewhere?

Thank you in advance.

PS: my form is not currently available for the public, but if needed I can make it so.
GreyHead 05 Mar, 2014
Hi Matten,

It should be OK, there may be a problem with the sequence that the code is being loaded in, I can't think of any other explanation. If you can let me see the form I can take a better look.

Bob
Matten 05 Mar, 2014
Hi Bob,

Here's the link:
http://www.psvbadmintonbrugge.com/CMS25/index.php/test-fpss-2

It's checking the option "Rode Competitie" (near the bottom of the form) that should:
- show the depending checkbox group (which now doesn't work because of 'formcheck' not being defined)
- register the checkboxes in the group so that the validation triggers upon submitting
- disposing the checkboxes in the group so that the validation doesn't happen when "Rode competitie" is not checked.

Kind regards,
Matten.
GreyHead 05 Mar, 2014
Hi Matten,

Please turn off the Dynamic File setting in the Load JS action and see if that fixes the problem. It does look as though the script is running before the FormCheck library is loaded.

Bob
Matten 06 Mar, 2014
Hi Bob,

I tried your suggestion, but it seems as though nothing's changed.
Matten 18 Mar, 2014
Hi Bob, any chance you have had time to have another look?
GreyHead 28 Mar, 2014
Hi Matten,

The code is commented out so I can’t check to see what is happening.

Looking at it, it might be simpler to disable the hidden inputs and re-enable them when they are re-displayed. FormCheck will ignore the validation on hidden elements so that works OK.

Bob
Matten 28 Mar, 2014
Hi Bob,

Yes, I commented that bit of code out because it prevented it to show the checkboxes upon ticking the option "Rode Competitie".
So now I looked into your remark about disabling the hidden inputs and re-enabling them when they are displayed again:
I used icrood_he.prop("disabled", false); (and then again but with true), but I'm getting the error "TypeError: icrood_he.prop is not a function".
Probably just me doing something wrong here, but I'm not seeing it.
Any ideas?

Thx in advance.
GreyHead 02 Apr, 2014
Hi Matten,

I'm not sure what your script is using icrood_he.prop("disabled", false) ??

If you have MooTools loaded and icrood_he is an element referencethen I'd use icrood_he.disabled = false;

Bob
Matten 02 Apr, 2014
Answer
Hi Bob,

That worked perfectly!
As for why I tried it the other way: I've tried to solve it myself at first given your directions in the previous reply and came to some jquery explanation, so that's what I tried. But since Joomla uses by default the mootools framework, that didn't work out.

I'll guess I'll read a bit more about it as well.

Thank you again for your help.
GreyHead 02 Apr, 2014
Hi Matten,

Just watch when you upgrade as Joomla! 3 switches so that both MooTools and jQuery are available but with a preference for jQuery,

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