json-tools/json-form

Question: Valid Form

ottigerb opened this issue · 1 comments

I am experimenting with your json-form and I like it so far!

What do you suggest for the following scenario:
Show only a [SAVE] Button when the form is valid?

Thanks for any helpful suggestions.

1602 commented

In case of web-component usage change event listener could get isValid as part of detail property. So usage would look like that:

form.addEventListener('change', e => {
    if (e.detail.isValid) {
        // show/enable save button
    } else {
        // hide/disable save button
    }
});

In case of usage in elm it is a similar change: external message Json.Form.UpdateValue will get second boolean argument.

This change makes perfect sense to me, thanks for poking me. Glad to know someone is experimenting with this stuff.