2

I want to modify a NewForm.aspx in a Task List to allow a custom string to be built. I have two fields, ID and Assigned To, and want create a third field that concatenates the two. Unfortunately, I cannot use the Assigned To column value in a calculated column.

I thought that I might be able to modify the form in SPD, but haven't a clue how to actually modify the field. This is what is present:

<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New"
FieldName="Task_x0020_ID" __designer:bind="{ddwrt:DataBind('i',concat
('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string
(@ID)),'@Task_x0020_ID')}"/>

Any suggestions (not involving career changes) to get me started?

Thanks!

Steve
  • 21
  • 2

2 Answers2

1

You will need to customize the NewForm.aspx using SharePoint Designer. A guide to doing this can be found here: http://office.microsoft.com/en-us/sharepoint-designer-help/create-a-custom-list-form-HA010119111.aspx#BM2 and here: http://kalsing.blogspot.com/2006/11/create-custom-list-form-for-sharepoint.html

Then to do the concatenation you are suggesting I would use Javascript to set the value of a field nested in a <tr> with class="hiddenRow". You can find some information about using Javascript to adjust your values on this page: http://blogs.msdn.com/b/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx

A great place to find some examples of how this is done is to install one of the fab 40 (the bug Database for example) and then open the custom forms for those lists in SharePoint Designer.

I know that is a broad answer and not a specific how-to, but it is a big question involving many steps. Hopefully the above links point you in the right direction.

theChrisKent
  • 15,029
  • 3
  • 61
  • 62
  • Chris, thanks for the links. I had actually done the first part, which resulted in the code that I posted. But the article on using Javascript looks like the way forward. Excellent! – Steve Jan 12 '11 at 06:00
  • 1
    If you want to use JavaScript, you could take a look at my library SPUtiltiy.js: http://sputility.codeplex.com/. You can use it to Get and Set field values. – Kit Menke Jan 12 '11 at 15:54
  • @Kit Menke, that project looks awesome! I'm gonna give it a try - glad I answered just to get this link! – theChrisKent Jan 12 '11 at 16:05
  • @Chris: Thanks! :) Hopefully it comes in helpful. – Kit Menke Jan 12 '11 at 17:57
0

You could just use SPD to create a simple workflow that concatenates the two fields together (Build a dynamic string) and sets your new field (set field in current item) whenever the item is created.

Kit Menke
  • 7,046
  • 1
  • 32
  • 54
  • Thnls, Kit. I'll give this a try and hope that I do not have the same concatenation problems in the workflow that I currently do in the form. – Steve Jan 12 '11 at 05:41