Can I save created forms into site template?
Posted by eedoh - Jan 31 ’14 at 12:25
Hello.
We're trying out Forms Designer and CrossSite Lookup for a project we just started. So far we like it, but we do have one BIG issue with them.
We're supposed to actually develop Sharepoint Site Template so the client can use that template each time they need to add new subsite. I just tried this, but after creating a subsite from the template, none of the list item forms are available. I just get the blank page (there's no even default Sharepoint form).
Letting the client import saved forms each time they add new subsite is not an option as the template is going to be huge.
Is there a way of saving the forms into the template and reusing them out of the box, or at least can we be sure that you're going to provide this feature in the next, say, 2 months, so we can go ahead and purchase the licenses, and upgrade the version later on?
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
Hello,
Currently, I can suggest the following workaround.
Before making a template, open your site in SharePoint Designer. Navigate to list where you have customized forms: Choose 'Lists and Libraries' in the left sidebar, select required list in the main panel. At the left bottom corner of this page you can find the list of content types. Choose content type which contains custom forms. Here you can change URLs of forms. Replace server relative path with ~list token. Examples:
Lists:
~list/fd_Item_Display.aspx
~list/fd_Item_Edit.aspx
~list/fd_Item_New.aspxDocument libraries:
~list/Forms/fd_Document_Display.aspx
~list/Forms/fd_Document_Edit.aspx
~list/Forms/fd_Document_New.aspxRepeat these steps for each content type of each list and library where you have designed forms.
Next, you have to make small modifications of forms themselves. Open a designed form in SharePoint Designer and find the following lines:
<SharePoint:ScriptLink ID="jquery" runat="server" Name="~sitecollection/style library/FormsDesigner/JQuery/jquery-1.10.2.min.js" OnDemand="false" /> <SharePoint:ScriptLink ID="jqueryui" runat="server" Name="~sitecollection/style library/FormsDesigner/JQuery/jquery-ui-1.10.3.custom.min.js" OnDemand="false" /> <SharePoint:ScriptLink ID="jquerycookie" runat="server" Name="~sitecollection/style library/FormsDesigner/JQuery/jquery.cookie.js" OnDemand="false" /> <SharePoint:ScriptLink ID="formsdesigner" runat="server" Name="~sitecollection/style library/FormsDesigner/form.min.js?rev=2_8_6" OnDemand="false" />
Replace them with the code below:
<script type="text/javascript" src="/style library/FormsDesigner/JQuery/jquery-1.10.2.min.js" /> <script type="text/javascript" src="/style library/FormsDesigner/JQuery/jquery-ui-1.10.3.custom.min.js" /> <script type="text/javascript" src="/style library/FormsDesigner/JQuery/jquery.cookie.js" /> <script type="text/javascript" src="/style library/FormsDesigner/form.min.js?rev=2_8_6" />
Repeat this step for each custom form. Then you can save the site as template.
-
Jeff ChildersMemberMember for: 9 years 9 months 9 days
I have tried the above solution and things don't quite work correctly.
1. First, my original New Form was "/sites/dev/Lists/Template_MedChrono/fd_MedChrono_NewForm.aspx"
2. Second, I changed the new form to "~List/Template_MedChrono/fd_MedChrono_NewForm.aspx"
3. Third, I went into fd_MedChrono_NewForm.aspx and changed the four lines to match exactly what was in your post.
4. When I save as a template and then create list in new site, it now finds the form and opens it; however, there appears to be a javascript problem since the form does not render with CSS (ie., fields are there, but no tabs, etc.)
5. Also, I notice that my cross-site lookup columns are not working properly. Does cross-site lookup columns affect the ability to use a template?
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
[#2]: Hello Jeff,
The instructions above are for SharePoint on-premises, not SharePoint Online. Instead of just replacing ScriptLinks with script tags, you should copy Name values from ScriptLinks, replace ~sitecollection token with site collection URL and put new values to src attributes of script tags.
-
eedohMemberMember for: 9 years 4 months 8 days
[#1]: Sorry for the late reply...
This worked perfectly for me. I do have some more issues, but not this big. This was a show-stopper. Thank you Dmitry.
I will post some more questions here, but this one was by far most important to me.
-
Jeff ChildersMemberMember for: 9 years 9 months 9 days
my site collection is https://XXX.sharepoint.com/sites/rootsite
I plan to create subfolders of this site as https://xxx.sharepoint.com/sites/rootsite/subfolders
When you say "replace ~sitecollection token with site collection URL and put new values to src attributes of script tags", do you mean to change the forms that I plan to use as templates to have https://xxx.sharepoint.com/sites/rootsite/subfolder/[stuff previously there] - if so, this will not work becuase "subfolders" will be unknown until the subsite is created.
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
[#5]: Hello Jeff,
You should replace SharePoint:ScriptLink controls with script tags in all your designed forms. Copy Name attribute of SharePoint:ScriptLink to script tag as I shown in my first comment but replace ~sitecollection token with URL of your site collection, '/sites/rootsite' in your case. So, your URLs will have the following view or so:
<script type="text/javascript" src="/sites/rootsite/style library/FormsDesigner/JQuery/jquery-1.10.2.min.js" />
-
Jeff ChildersMemberMember for: 9 years 9 months 9 days
Not able to get this to work. Here is what I am doing exactly. I have create a subsite with path /sites/dev/subsite.
I created a list in the subsite called "providers". I convert the form locations to:
"~list/fd_providers_NewForm.aspx" (and do the same for edit and display)
I delete the script links and add the following scripts:
<script type="text/javascript" src="/sites/dev/style library/FormsDesigner/JQuery/jquery-1.10.2.min.js" />
<script type="text/javascript" src="/sites/dev/style library/FormsDesigner/JQuery/jquery-ui-1.10.3.custom.min.js" />
<script type="text/javascript" src="/sites/dev/style library/FormsDesigner/JQuery/jquery.cookie.js" />
<script type="text/javascript" src="/sites/dev/style library/FormsDesigner/form.min.js?rev=2_8_6" />I then save the provider list as a template.
Now, if I create the provider list from its template at /sites/dev/newsubsite/provider - it cannot find the forms
If I save /sites/dev/subsite as a site template with the provider list in it, it cannot find the form.
What am I doing wrong?
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
[#7]: Hello Jeff,
Are you sure that you saved the modified content types? Is it possible to provide temporary access to your SharePoint Online? If so, please, send it to [email protected].
-
Jeff ChildersMemberMember for: 9 years 9 months 9 days
[#8]: I want to thank you for helping me with this. In the end, for Office 365 deployments, the solution to this problem is a bit different from what is identified above. All that is required is to edit the content type to read:
~list/fd_Item_DisplayForm.aspx
~list/fd_Item_EditForm.aspx
~list/fd_Item_NewForm.aspxThen save the list as a list template. There is no need to modify the three fd forms as they are already properly referenced for a subsite. I have also not found any problems or modifications necessary for cross-site lookup columns.
NOTE: if you later change the list, you must go back in and edit the default list form locations for that content type.
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
[#9]: Hi Jeff,
Yes, there is no need to modify files themseves but only if you make template from a list. If you make site template you must modify form files as described above.