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

Add support of typeField property validation message #4450

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

GogoVega
Copy link
Contributor

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

This PR is an extension of #4449 and was discussed inside.

If an input is builded with typedInput and contains the typeField option:

$("#node-input-path").typedInput({
    default: "str",
    typeField: "#node-input-pathType",
    types: ["str", "msg"],
});

and node properties contains a validator for typeField:

defaults: {
    path: {
        value: "",
        ...
    },
    pathType: {
        value: "str",
        validate: RED.validators.regex(/^str$/),
        ...
    }, ...
}

This PR adds a validation tooltip message to the field if the typeField validation is not correct.

In the example, validation only accepts the type str not msg:
Capture d’écran 2023-11-27 à 11 27 14

Note: the message on the screenshot is not the message that the example should produce

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@knolleary knolleary added this to the 4.0 milestone Jan 19, 2024
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 this pull request may close these issues.

None yet

2 participants