Skip to content

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

@jdvorak23

Description

@jdvorak23

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions