How to programmatically customize editform.aspx/newform.aspx with SP2007? - sharepoint

I have been looking for a solution for hours but I can't manage to customize my list forms. Although it is very easy to modify the form under SPDesigner, I can't find a way to do the same in VS2008.
Does anyone know the way to customize a form programmatically ?
Thank you very much

The best way to customize newform.asxp and editform.aspx (in my opinion) could be :
On a new visual studio solution :
Define your content type for the list
Define a list shema based on the CT
In the section "forms" in the schema.xml define your own aspx for editform.aspx and newform.aspx like
<Forms>
<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourListDefinitionPathInSolution\YourEditForm.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\YourListDefinitionPathInSolution\YourEditForm.aspx" UseLegacyForm="True" WebPartZoneID="Main" />
</Forms>
In this blog post you will find the good recipe : Create custom SharePoint 2010 list form for deployment in a Visual Studio 2010 project
Regards
EDIT : sorry, recipe for 2010 version :-(

What you are suggesting does not sound like best practice, the newform.aspx, editform.aspx, etc. are the SharePoint out-of-the-box forms for the list and should probably be left alone.
What changes are you making? Simple changes like increasing the size of text boxes or substantial changes?
You can create your own forms if the changes are substantial

Related

Create own customized Web Content List

I'm looking to create my own Web Content List portlet. I exactly want to display the web content of my portal applying some filters.
I'm a little bit lost...
I tried to create a hook but I dont know how to find the possible actions of this portlet.
I don't want to get all the content. I want to use a rules mechanism for filtering the contents(drools portlet), depending on the user information.
Thank you in advance,
Oriol
You can get the list of web contents by using following method:
List<JournalArticle> result = JournalArticleLocalServiceUtil.getArticles(groupId, -1, -1);
You can display the list using liferay search container as:
<liferay-ui:search-container delta="30" emptyResultsMessage="no-users-were-found">`
<liferay-ui:search-container-results>`
results="<%= result%>"
total="<%=result.size() %>" />
<liferay-ui:search-container-row
className="com.liferay.portlet.journal.model.JournalArticle"
keyProperty="articleId"
modelVar="content" >
<liferay-ui:search-container-column-text
name="ID" value="<%= content.getArticleId()%>" /> // You can add multiple columns
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
Hope this will help you.

How to get document datasource in another Custom Control?

I have an xPage with this content:
<div class="lotusFrame">
<xc:layoutCommonBanner />
<xp:callback facetName="facetTitleBar" id="callbackTitleBar" />
<xc:layoutDiscrepancyPlaceBar />
<div class="lotusMain">
<div class="lotusColLeft">
<xp:callback facetName="facetColLeft" id="callbackColLeft" />
</div>
<div class="lotusColRight">
<xp:callback facetName="facetColRight" id="callbackColRight" />
</div>
<div class="lotusContent">
<xp:callback facetName="facetContent" id="callbackContent" />
</div>
</div>
<xc:layoutCommonFooter />
<xc:layoutCommonLegal />
</div>
As you can see, there are several custom controls in it composing layout. In the facetContent, there is a document with document datasource. It's the only document in the page. I need to get this document somehow in the layoutDiscrepancyPlaceBar custom control.
I found some old articles on the web with undocumented feature called currentDocument. It should be on every page with document datasource. But it doesn's work. I have Domino 8.5.2 and currentDocument seems to be no longer supported.
Can you help me out? How can I get document datasource from one custom control in another custom control. Is it even possible?
Thanks in advance, Jiří
EDIT: OK, it is still supported, but it only works in custom control, that is included inside the one with document datasource. In the case scenario above it doesn't work.
Your best option is to hand over the binding name in a custom property. (lets call it bindto. Then you bind your field to
"${#{"+compositeData.bindto+"}}"
See details here (inside the prezi)
P.S. currentDocument is documented somewhere.
You can also pass a handle on the data source directly to the custom control, as well as the name of the item to bind to on the data source. Because EL supports array syntax as well as dot syntax, this allows you to define expressions like this:
#{compositeData.dsn[compositeData.fieldName]}
(where "dsn" is the property being passed the handle on the data source, and "fieldName" is the property being passed the name of the item to bind to on that data source.)
More details on this approach can be found here.

SharePoint BCS creating a hyperlink column

I am using the .NET connector to connect to an SQL database. One of this value is a URL. Now I need to display this as a URL.
Any ideas on how to solve this?
In Sharepoint Designer you can edit the read list and go to the field, so for example you have a field called URL, display it as a label so it would render like
<asp:Label runat="server" id="ff1{$ID}" text="{$thisNode/#URL}" />
Then all you need to do is add an "A href" tag to it so it renders as a url like such
<asp:Label runat="server" id="ff1{$ID}" text="{$thisNode/#URL}" />

Update SharePoint custom list Displayform on existing site collection?

I have an existing site collection with a bug that I need to fix where a custom document list has been created along with an override file for the displayform:
<Form Type="DisplayForm" ToolbarTemplate="BLPDocLibDisplayFormToolBar" SetupPath="pages\kmform.aspx" Url="DispForm.aspx" WebPartZoneID="Main" />
<Form Type="EditForm" SetupPath="pages\form.aspx" Url="EditForm.aspx" WebPartZoneID="Main" />
<Form Type="NewForm" Url="Forms/Upload.aspx" WebPartZoneID="Main" />
<Form Type="NewFormDialog" Path="EditDlg.htm">
Being a novice at SharePoint I have no clue or can find anything useful out there on how I can update the deployed override file Dispform.aspx as it appears that every list has it's own copy of the file.
Anyone know how this can be done?
Thanks in advance.
Dan
Please clarify your question. Do you mean that you have created many lists of this custom type and now need to change the display page to the default one instead of custom?

SharePoint Search on default Masterpage

I am trying to enable the search bar on my default master page. In the source code of the master page there is the following:
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
In the render of the page in design mode it says [DelegateControl]. When I publish the page, I do not see a search box, I see nothing... can someone point me in the direction as how to enable search on my default master page, thanks.
I had the exact same problem but eventually found a very simple solution. You just need to make sure your asp:ContentPlaceHolder is within an html form. I don't know exactly why this is the case, but simply changing your code to
<form id="Form1" runat="server">
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
</form>
should solve the problem.
I found this very simple application.master page: http://blogs.microsoft.co.il/blogs/justguy/archive/2008/08/31/empty-application-master.aspx
When the search boxes worked using this simple master page, I was able to track down the problem and find the needed element.
Are you certain that you MOSS Search service is correctly configured?
If not, check this article:
http://www.mysharepointblog.com/post/2008/10/Configure-Search-On-MOSS-2007-(Microsoft-Office-SharePoint-Server).aspx
Have you activated the "Office SharePoint Server Standard Site Collection features" from the site features?

Resources