Custom Widget Development - display form in custom widget

0
Hello, I have a question, I am creating a custom widget, where I want simply pass form from the parent view and make widget re-usable.   I have added property of type "form"  to the .xml configuration file and in my widget.js file I`m able to read a value that is passed.   The last step that left is to display that form in the HTML, is there any common way?      
asked
2 answers
2

Hi Damian,

You can open a page from within the widget using this Javascript code:

mx.ui.openForm("Administration/EmailTemplate_Overview.page.xml", {
    location: "content",
    callback: function(form) {
        console.log(form.id);
    }
});

More information about this function you can find in the documentation at https://apidocs.mendix.com/7/client/mx.ui.html

By the way, there is not an option to send a form name as input parameter in a microflow, such that the microflow could open that page. But you can pass along a String value off course.

To display a page inline, you could take a look into the widget FormLoader, not sure if that's compatible with Mx 7, but it is compatible with Mx 6.

Kind regards,

Johan Flikweert

answered
0

I am no master at widget building but to my knowledge it is possible to trigger a microflow from the widget. This way you could depending on the result call a microflow that opens this form. Not a sollution if you have a lot of different forms but doable with a small number of forms.

Regards,

Ronald

 

answered