Adding extra params to the OOTB Create Forum Port widget?

I'm doing some research for a customization request, and was wondering if it is possible to add additional fields to the Create Forum Post widget.

I can add a new form field without any issue, but the widget submits the form with JS code, and it doesn't pass my new field to the server.

In the code I see this...

        forumId: $forum.Id,
        applicationId: '$forum.ApplicationId',
        replyId: #if($threadOrReply && $threadOrReplyType == 'reply') $threadOrReply.Id#else -1#end,
        threadId: #if($threadOrReply && $threadOrReplyType == 'thread') $threadOrReply.Id#else -1#end,

My expectation is that this JS function handles grabbing all of the form data and submits it to the server, which makes sense.

So what my question is, is this mechanism extensible?  Are there arguments that I can pass to that function that will allow me to pass additional form field values to the server?


  • Hey,

    It is possible to save additional data with a post but would require customisations to the javascript used when saving the post (this is in the ui.js file in the widget).

    The javascript builds the data from the form and then makes a REST API request to create the post, the _populateData method would need to be extended to get the new values and pass them to the API in the correct way.

    Depending on the data you want to store would have to decide how to store it, Extended Attributes are an easy way, but have some flaws, and having the data saved seperately has many advantages. The syntax for saving extended attributes is also a little tricky, more information on both of these is in this thread.

    Hope this helps 

  • Thanks Rhys, this is great and I was able to implement a proof of concept.

    My specific goal was to implement a way to allow someone to post content as another user without having to resort to using the Impersonate function (and requiring admin access).  With your help I was able to modify the OOTB Forum Post widget to be able to do this pretty easily.