-
Hello, I am trying to add a few different traits to the input element but am unable to understand how to bind the traits with the input. The default traits (placeholder, required, etc.) work fine but not the custom ones. I created a JS Fiddle to show what's not working. Here is the following I am trying to achieve:
I have gone through a ton of articles and also checked a lof of the issues on GitHub and also reviewed the documentation, but as a new learner of GrapesJS builder, I haven't figured out a solution yet. JS Fiddle link: https://jsfiddle.net/pshrLew4/3/ Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You should read this section: https://grapesjs.com/docs/modules/Traits.html#add-traits-to-components. Specifically in the "Add Traits To Component" section where it references the changeProp. From what I can tell, you are setting a property, not an attribute because of your changeProp: 1. That is fine if you don't want it to show up as an attribute in the tag, but you will want to react to the property change to add your span tag for error message etc. |
Beta Was this translation helpful? Give feedback.
-
@dm-siegel Thank you for the insights. I figured out what I was doing wrong and got it working. |
Beta Was this translation helpful? Give feedback.
You should read this section: https://grapesjs.com/docs/modules/Traits.html#add-traits-to-components. Specifically in the "Add Traits To Component" section where it references the changeProp.
From what I can tell, you are setting a property, not an attribute because of your changeProp: 1. That is fine if you don't want it to show up as an attribute in the tag, but you will want to react to the property change to add your span tag for error message etc.