Change default value of List in SharePoint w/o going to List Settings?

Hello Experts,

Is there a way to change the default value of a column w/o going into List Settings?  I have a List that has a default value for a column (category) setup.

When I have to enter a lot of data (items) for a particular hardware category (monitors, desktops, phones, laptops, etc), I'd like to be able to change the default of the category w/o having to go into the List Settings.

I would appreciate any guidance...thank you.
Modifier1000Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
which SharePoint version and edition?
What field type is your column?

The one possible workaround I can think of is to pass the value via query string (url parameter) having a small Javascript on the new item page to replace / set this field.

HTH
Rainer
0
Modifier1000Author Commented:
Hello,
Sorry for my lack of info...my bad.

SharePoint Version:  2010 Enterprise
Column Type: Choice

I'll standby with your "possible workaround" in case the version/column-type I just provided make a difference for another possibility.
0
Rainer JeschorCommented:
Hi,

this script will try to get an url parameter named "categoryfield" and set the select field "AssetType" (based on the title of the field):

<script language="javascript" type="text/javascript" src="/sites/ee/SPServices/JSAssets/jquery-1.8.3.min.js"></script>
<script language="javascript" type="text/javascript">
var queryParamName = 'categoryfield';
var selectFieldTitle = 'AssetType';

_spBodyOnLoadFunctionNames.push("SetDefaultValue");

function SetDefaultValue()
{
	var valueFromQuerystring = GetUrlParamValue(queryParamName);
	
	if (valueFromQuerystring != null) {
		jQuery("SELECT[title='" + selectFieldTitle + "']").val(valueFromQuerystring);
	}
}

function GetUrlParamValue(urlParam){
    var queryString = window.location.search.substring(1);
    var urlParams = queryString.split('&');
    for(var i = 0; i < urlParams.length; i++){
        var urlParamElement = urlParams[i].split('=');
        if(urlParamElement[0].toLowerCase() == urlParam.toLowerCase()){
            return urlParamElement[1];
        }
    }
	return null;
}
</script>

Open in new window


Necessary script adjustments:
- Adjust the path to the jQuery library to fit your environment. (you might also use the jQuery library from the CDN from Google/Microsoft)
- Adjust the variable queryParamName
- Adjust the variable selectFieldTitle and set it to the title of your select field

To get it run you have to options:
Either place the script using a content editor web part OR use SharePoint designer to inject the code directly on the new item page.

If you need further assistance just post your comment.

HTH and KR
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Modifier1000Author Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.