Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netteForms.js doesn't toggle properly when form is reset #306

Closed
jdvorak23 opened this issue Apr 27, 2023 · 0 comments
Closed

netteForms.js doesn't toggle properly when form is reset #306

jdvorak23 opened this issue Apr 27, 2023 · 0 comments

Comments

@jdvorak23
Copy link

Version: netteForms.js 3.3.0

Bug Description

Toggle in netteForms.js doesn't work properly, whent there is a type='reset' button, or the form is reset() anyhow. 'reset' event doesn't fire 'change' event on controls, but changes them.
If you check Checkbox in example, TextArea will show, if you then click reset button, Checkbox is unchecked by reset, but TextArea is not toggled properly.

Steps To Reproduce

class TestFormFactory
{
    public function create() : Form
    {
        $form = new Form();
        $form->addEmail('email', 'Your email');
        $form->addCheckbox('send_me')
            ->addCondition($form::Equal, true)
            ->toggle('#frm-testForm-address');
        $form->addTextArea('address');
        $form->addSubmit("save", "Save");
        $form->addButton('cancel', 'Cancel')
            ->setHtmlAttribute("type", "reset");
        return $form;
    }
}

Expected Behavior

Form's 'reset' event should be handled for toggling properly.

Possible Solution

Somehow handle 'reset' event on forms and toggle controls which needs it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants