Form Load and CheckBox Validate

BNDragon 05 Jan, 2015
Hi there,

I have two issues, first the Form Load, I created a Form to Login, but in that form I created a Register/Login Form, but, I'm only need the part of Register Form in Register Menu and the Login part in Login Menu, so it's look easy to do, I just copy my big form twice and delete what I don't need, so I have 3 form now: RegisterLoginForm, RegisterForm and LoginForm.
The Original form name was RegisterForm, so I changed it to RegisterLoginForm. The problem is that the Register Menu still show RegisterLoginForm, I've already clear cache from Joomla and from Browsers (IE,FF,Chrome) still the same result. Why this happen?

The second issue is how to validate my checkbox? I don't want to make it required because, ie, in my RegisterLoginForm form, the user don't need to check the checkbox to Login, so I need it to be validated in Server side OR make it required just when the user is Sing-in.


Thanks,
BN
BNDragon 05 Jan, 2015
Hi,

The first issue is solved, the problem wasn't in joomla/cf/cache, was an Chrome Issue, the chrome wasn't save the new settings, I changed then on FF and it works now.


Still, need help with the check box validation issue.

Thanks
BN
GreyHead 06 Jan, 2015
Hi BN,

I don't understand from your post when the check-box needs to be validated. In CFv5 you can change the validation class using JavaScript - would that solve the problem?

Bob
BNDragon 06 Jan, 2015
Hi Bob,

That would solve the problem, I'll try to make it.

Explaining better the problem:

I have one form with "two" submit buttons ("two" because its one for Login and three to register, each one for each user group).
So, in the first part of form I have the login fields (Username, Password and Login button) and in the second part the register fields (name, username, password,...,Check-box to agree with the terms of service and the register button) as you can see in the image.

[attachment=0]Form.PNG[/attachment]

What I want is that the check-box became required when the user is registering. If the user click in "Entrar" the check box don't need to be checked, but if the user click on "Registar" it need to check it.

Hope that I explained myself a little better now.
Now I'll try to make the js validation.

BN
BNDragon 08 Jan, 2015
Hi Bob,

Sorry, but I couldn't understand how to do it. Can you give me a little help?

Thanks,
BN
BNDragon 15 Jan, 2015
Answer
Hi there,

Finally get the function, some why is kind of hard work if disable and enable to me :/
But I make it work😀 Here you have a custom JS, it actually not validate the check-box, it just enable/disable the submit button.
// enable/disable function
jQuery(function() {
    jQuery.fn.extend({
        disable: function(state) {
            return this.each(function() {
                var $this = jQuery(this);
                if($this.is('input, button'))
                    this.disabled = state;
                else
                    $this.toggleClass('disabled', state);
            });
        }
    });

// disable submit buttons
jQuery('.bReg').disable(true);

//cacth event change on check-box
// if checked  enable submit buttons else disable submit buttons
    jQuery( "#termosCondicoes" ).change(function() {
if(this.checked){jQuery('.bReg').disable(false);} else {
jQuery('.bReg').disable(true);}
});
});


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