Recently I had to take 3 single column fields and condense them into 1 multiple text field. Those 3 columns are Name, Location and Code. However, to make it easy for people to fill out I want these names to be pre filled in on a new display form that looks like this
Name:
Location:
Code:
This is to have some sort of organization in the column when they need to fill in the data. I found a blog post but this was for 2007 titled "Using Javascript to Manipulate a List Form Field".
.
I did try to use this javascript code on 2010 and so far Sharepoint is taking kindly to it, it seems. My issue is that I am unsure as to where to put my values.
My thoughts are that I have to replace nameVal with my values because I am inputting them into the text field.
Any help would be great as I am still learning Javascript and am no expert with it.
_spBodyOnLoadFunctionNames.push(“fillDefaultValues”); function getTagFromIdentifierAndTitle(input, TextField, Name, Location, Code ) { var len = identifier.length; var tags = document.getElementsByTagName(input); for (var i=0; i < tags.length; i++) { var tempString = tags[i].id; if (tags[i].title == title && (identifier == “” || tempString.indexOf(identifier) == tempString.length – len)) { return tags[i]; } } return null; } function fillDefaultValues() { var qs = location.search.substring(1, location.search.length); var args = qs.split(“&”); var vals = new Object(); for (var i=0; i < args.length; i++) { var nameVal = args[i].split(“=”); var temp = unescape(nameVal[1]).split(‘+’); nameVal[1] = temp.join(‘ ‘); vals[nameVal[0]] = nameVal[1]; } // Set HTML element default values here }