This was the challenge.
For a customer i was creating a template site the needed a custom editform.aspx. After editing the custom form.aspx it all worked fine. But after creating a new site based upon the newly created template i discovered that my custom editform.aspx was not working. The reason for this is that the webpart i used was connected to a list using the ListID (guid). This was of course pointing to the list in another site.
The solution is to use the ListName instead of ListID. To do this you need to edit the webpart code using SharePoint Designer.
Open the site in SharePoint designer. Select the webpart and click on “Split view” to reveal the code.
Now change every occurrence of ListID in ListName. And replace the guid with the listname. See the examples in these screenshots.
In my case i had to replace six occurrences of ListID.
Save the site and create a new temmplate and you’re all set!