[QUESTION] Require trait, check status
Question
I have a project that requires a form, currently using the form plugin, and each element of the form requires a name. While this is a trait, is it possible to require a trait and check all nodes to determine if they meet their requirement?
Following my example one would create a form where the nodes have a required trait of name. A command can be executed to determine if all nodes meet this criteria.
I see in the trait manager documentation that there is a code example with required true. This is not at the individual trait level however. Would greatly appreciate the community guidance!
Answers (1)
What you see in the documentation it's just about the required attribute (eg. <input ... required/>), so nothing blocks the user from storing the template.
In your case, you can create a kind of check before storing which queries all the forms and looks for names in all elements, if an element misses the name attribute raises an error
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2066
[QUESTION] Page Limit
I'm currently using GrapesJS as a Letter/Form Composer, and it's been working wonderfully so far. However I'm just finishing up the last fe...
Issue #3287
QUESTION: Wrapper styling
First of all, congrats @artf for this amazing project 💯 I am currently working on a project and I wanted to ask if I can edit the wrapper...
Issue #2693
[BUG] Rich Text Editor's position is not updated on enter/return
Once again thanks for all the hard work on the project! This is reproducible on the current release 0.16.3 - you can check it out in the ne...
Issue #3399
Convert JSON to HTML server-side
So first of all, thank you @artf for this amazing project. I have a question: Is it possible to easily convert the components-JSON to HTML...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.