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

[Improvements] Add disable action #3

Closed
Tropicalista opened this issue Feb 28, 2021 · 1 comment
Closed

[Improvements] Add disable action #3

Tropicalista opened this issue Feb 28, 2021 · 1 comment

Comments

@Tropicalista
Copy link

At the moment the only action supported are hide and show. A nice addition would be a disable action.

This can be useful to disable certain field until a correct value is entered. And also the most used use case is to disable the button, for example if the privacy policy is not accepted.

I have digged a bit trough the code, but seems not a simple implementations at the moment. It would require some code refactoring.

Tropicalista pushed a commit to Tropicalista/mf-conditional-fields that referenced this issue Mar 1, 2021
@bomsn
Copy link
Owner

bomsn commented Mar 1, 2021

Feature is added, you can now simply pass the enable/disable action in the rules.
For example:

// Parent Field
<input type="checkbox" name="disable_parent" id="disable_parent" value="yes"> <label for="disable_parent">


// Child field
<button type="submit" name="disable_this" class="btn btn-primary">Submit</button>


// Rule
{
    "field": "disable_this",
        "action": "disable",
        "rules": {
            "name": "disable_parent",
            "operator": "isnot",
            "value": "yes"
    }
}

@bomsn bomsn closed this as completed Mar 1, 2021
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

Successfully merging a pull request may close this issue.

2 participants