Skip to main content
Home  ›  Docs › Prefill new Forms

Prefill Form for New Entity

Warning ⚠️: New Docs Available

These are old docs and we haven't found the time to completely move them. You will find comprehensive new docs on

Introduced in Version 05.05.01

Sometimes you want to pre-fill a new Entity with existing information - like the current date, the users name, or data from another list like a file-ID or infos from an XML-Stream. This is now possible.

Server Side Helpers in 8.4.5

UPDATE since 2sxc 8.4.5 you can also set the prefill with the server-side Edit.Toolbar helper. This is usually much easier. Not fully documented yet, but approx. like this:

@Edit.Toolbar(actions: "new", contentType: "NewsItem", prefill = new { Category = "something" } )

Note: You should have a Sherlock-Snippet in the template editor that helps you with this.

JS Methods (older, harder way)


It is not well documented yet, here a quick demo in the current implementation. We're basically doing the following

  1. Test if the user is currently editing this
  2. Test if the title of the entity is the demo-entity (the one configured in the list-settings)
  3. If no, then just give it the default toolbar
  4. If it is the demo entity, then an edit will of course give a new record. Then assemble the toolbar the way the automatic toolbar is built...
  5. ...and give it a parameter "prefill=" with JSON containing keys/values


<div class="sc-element">



        if(Content.Title != "Demo Feature")


            @*currently not showing the demo-entity, so show the normal toolbar*@





            @*currently showing the demo-entity, so show the prefill-edit-button*@

            <ul class="sc-menu-deactivated">


<a class="sc-menu-edit" href="javascript: $2sxc.beta.OpenDialog('new', { moduleId: @Dnn.Module.ModuleID, tabId: @Dnn.Tab.TabID, contentGroupId: @List.First().GroupId, sortOrder: 0, returnUrl: 'Default.aspx?tabId=@Dnn.Tab.TabID', prefill: { DocumentedOnPage: 'Page:@Dnn.Tab.TabID', Title: '@Dnn.Tab.Title' }}); ">create for this page <img src="/DesktopModules/ToSIC_SexyContent/Images/Edit.png" /></a>





more stuff here...</div>


Here the List-version:

@foreach(var Element in List)


                var Content = Element.Content;

                <h1 class="sc-element" onclick="$2sxc.beta.OpenDialog('new', { moduleId: @Dnn.Module.ModuleID, tabId: @Dnn.Tab.TabID, contentGroupId: @Element.GroupId, sortOrder: @Element.SortOrder, prefill: { Name: 'Person ' + new Date() }});">





Error Showing Content - please login as admin for details.