Need a feature to integrate modal form
Question
[FEATURE REQUESTS] I have to add block which should a open a modal with form fields. Based on the form data selected I have to generate a html string and insert it to editor. and on click /double click of the component, modal should open again with the form details. How can I do this? Please help.
Answers (3)
Hello @suchiitsme i think you can implement a component type.
comps.addType('custom-form', {
model: defaultModel.extend({
defaults: {
...defaultModel.prototype.defaults,
removable: false,
draggable: false,
copyable: false,
editable: true,
propagate: ["removable", "draggable", "copyable", "editable"]}
}, {
isComponent: function(el){
result = "";
if (el.tagName === "form" && el.getAttribute("class").toString().indexOf("customForm") > -1) {
result = {type: "custom-form"}
}
return result
}
}),
view: defaultView.extend({
defaults: {...defaultView.prototype.defaults},
events: {
click: function(event) {
alert("Do anything")
}
}
}
}),
});
Hello @suchiitsme i think you can implement a component type.
comps.addType('custom-form', { model: defaultModel.extend({ defaults: { ...defaultModel.prototype.defaults, removable: false, draggable: false, copyable: false, editable: true, propagate: ["removable", "draggable", "copyable", "editable"]} }, { isComponent: function(el){ result = ""; if (el.tagName === "form" && el.getAttribute("class").toString().indexOf("customForm") > -1) { result = {type: "custom-form"} } return result } }), view: defaultView.extend({ defaults: {...defaultView.prototype.defaults}, events: { click: function(event) { alert("Do anything") } } } }), });
Thank you. I will give a try!!
Hi How do I link this to block?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2129
[Question] how to append a button inside default modal and catch it's click event
I want a form inside a modal (using the default modal ), on click of the submit button make an ajax call. I have created a new component wh...
Issue #3135
[Help Wanted] How to easily override existing component ?
For example, I want to add a double click event handler on the default video component to open the assets manager. My basic idea was to get...
Issue #3239
[Question] How to update attribute/properties dynamically from Component Script?
We have a use case where we want to insert charts dynamically using Highcharts Editor. I have created a component, which on drag and drop,...
Issue #912
[BUG]: HTML attributes/traits not escaped
When double quotes are added to an attribute it breaks the HTML.https://jsfiddle.net/szLp8h4n/Drag in the link block.Click the link in the...
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.