Displaying online form inside a widget

Novice User asked on January 20, 2018 00:02

In my widget, I am trying to grab content from an editable region of a document and displaying it elsewhere. Its works great where there is text inside an editable region. If there is any online form inside an editable region it just grabbing this

""{^widget|(name)BizForm|(BizFormName)TestFormName|(widget_displayname)On-line+form^}""

How can I grab the online form in a way that it can be displayed and function as online form here is my code where i am traversing through multiple regions in a document and grabbing the content in an array.

int count=0;
    var PageItem = DocumentHelper.GetDocument(docId, new TreeProvider());

    countEditableRegions = PageItem.DocumentContent.EditableWebParts.Count;

    string[] tabContent= new string[countEditableRegions+1];

    foreach(DictionaryEntry EditableWidgetNameKeyValue in PageItem.DocumentContent.EditableWebParts)
    {
        string key = ValidationHelper.GetString(EditableWidgetNameKeyValue.Key, "");
        string WebpartID = key.Split(';')[0];
        tabContent[count] = PageItem.DocumentContent[WebpartID];
        count++;

    }

Any idea would be helpful. Thanks

Recent Answers


Trevor Fayas answered on January 20, 2018 00:43

There may be an easier way than what you are doing.

If you are trying to just have a "Shareable" piece of content, then a better way is to place that shareable object as Page Content somewhere on the content tree, then pull that in with a Page Placeholder specifically pointing to that piece of content, and using a template that doesn't inherit the surrounding content.

So Page "SharableContent" with a template that has a WebpartZone Called "TheContentZone" and have it inherit the nearest master page.

Create a "StrippedSharableContent" template that has the same WebpartZone called "TheContentZone", but this one will NOT inherit any parent pages.

Add your Shareable Content page, put your form and stuff inside of it (you can turn the zone to a widget zone if you wish, just do so on both templates)

Then you can make a widget of the Page Placeholder, allow them to select the shareable content, and set the template to "StrippedShareableContent"

1 votesVote for this answer Mark as a Correct answer

Novice User answered on January 22, 2018 23:02 (last edited on January 23, 2018 00:05)

Thanks for pointing me toward the right direction. I placed the literal control inside a place holder and did some what like this.

this.ltlContent.Text = (string)PageItem.DocumentContent["Myeditabletextregion"];
CMS.ExtendedControls.ControlsHelper.ResolveDynamicControls(this.plcContent);

Problem is that I may have normal text as well in some case. So how to I detect that there is any bizform in here so i can toggle between show/not show the literal control. Would it validate and submit like it should or i need to force submit it ?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.