Dynamic Forms within Forms?

Hi.

I’d like to use the Tab container to present dynamic forms – the contents of a tab stored in a SharePoint list which is code saved from the Forms application (all the Grid/Row/Cell/Fields in an .xfds file). Can you tell me if this is possible? I copied everything inside a tab <Tab Header="Tab 2"></Tab> hoping that I can get that code built and rendered as part of the main spform. Obliviously not that easy.

Thanks!
-Bjorn

Dear Bjorn,

You can’t change form’s template dynamically through injection of .xfds files since the configuration transforms into html while saving a form in the designer.

But there is another solution. You can design a separate public Plumsail form for each report. Then, create a master form with two tabs - the first one with a drop-down field with a list of reports and the second - the report itself that will be initialized dynamically with a selected form like a regular public form.

Steps to embed a public Plumsail form in the Sharepoint Plumsail form:

  1. Create a public Plumsail form, copy its ID (bottom left corner)

  2. Add HTML-control on the master form with the following content:

    <div id="plumsail-form1"><div class="fd-form-loading"></div></div>

  3. Add a code in the JavaScript Editor of the master form, like this:

      fd.spRendered(function(){
         $.getScript("https://forms.plumsail.com/widget/1.0.4/app.js").then(function() {
             var fd2 = new Plumsail.Form("#plumsail-form1", "<FormID>");
         })
     }) 
    

Note the following:

  • replace with ID copied on the first step

  • ‘plumsail-form1’ is ID of the div element added on the second step

  • you should launch new Plumsail.Form() inside ‘$.getScript.then’ function

Dear @Bjorn,

Also, anyone else reading the topic. We’ve added some improvements.

Now you can use both, Public and SharePoint form simultaneously. We’ve split the constructors: Plumsail.PublicForm - creates a public form, Plumsail.SharePointForm - creates a SharePoint form.

Tell us if you find anything unclear!

Hi Aleksey,

Unfortunately that broke my implementation. I don't know if it matters, but I'm calling a new public form from within a Sharepoint form. Here's the console log when I changed it to Plumsail.PublicForm():

This was the code you'd helped me with before:

    function setReport(plumsailFormID) {
        $(".report-container").empty();
        $(".report-container").append('<div id="plumsail-form1"><div class="fd-form-loading"></div></div>');
        window.fd2 = new Plumsail.PublicForm('plumsail-form1', {formId: plumsailFormID,});
        fd2._rendered = [];
		if (fd.field('ReportParameters').value) {
			fd2.rendered(function(){
				fd2.data(JSON.parse(fd.field('ReportParameters').value));
			});
		} else {
			fd2.rendered(function(){fd2.clear();});
		}
    }

If I hardcode a form ID, like:
window.fd2 = new Plumsail.PublicForm('plumsail-form1', 'b696010d-6842-49d0-b755-400c14ef800f');

I don't get that object error, but the embedded form doesn't load, it just spins. Any ideas?

Dear Bjorn,

I’m sorry for a late reply and the inconvenience, I hope you’ve saved your forms with previous implementation.

It will take a little more time to test and soon I’ll give you an answer.

Dear Bjorn,

I’ve reproduced this error. It seems like a bug, I have to discuss that with my colleagues tomorrow.

Dear Bjorn,

Please try this code:

function setReport(plumsailFormID) {
    $(".report-container").empty();
    $(".report-container").append('<div id="plumsail-form1"><div class="fd-form-loading"></div></div>');
    window.fd2 = new Plumsail.PublicForm('#plumsail-form1', plumsailFormID);
    fd2._rendered = [];
    if (fd.field('ReportParameters').value) {
        fd2.rendered(function(){
            fd2.data(JSON.parse(fd.field('ReportParameters').value));
        });
    } else {
        fd2.rendered(function(){fd2.clear();});
    }
}

Thanks Aleksey, that fixed it!

Hello! I realize this is a very old topic, but the this topic is the only place I can find mention of an API for Plumsail.SharePointForm.

This looks like something I might be able to use to embed an existing Display Form (customized with Plumsail forms for SharePoint Online) into another form.

I have tested the Plumsail.PublicForm API to embed a public form into a SharePoint form, and while that does work, I would like to be able to do the same with a display form from SharePoint Online.

Perhaps what I am trying to achieve is not possible, or perhaps there is an even easier way than the method I am pursuing.

Dear @brduncan,
The API for public web forms and SharePoint forms is very different, so it might not be possible at the moment - you can however have multiple forms on one page with Plumsail Form web part, or you can use Dialog to open additional SharePoint forms.

If you would like to expand the existing functionality, you can write a more detailed request to support@plumsail.com, perhaps we'll be able to offer paid support for an extension, but this depends on the exact request.

Understood. I did consider that because this API does not appear to be documented publicly, it probably should not be used. What I am attempting is not required, but more of a "nice to have". I shall explore other avenues such as what you have suggested.

Thanks!