Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Set Default Value of BDC Field with Javascript

  Asked By: Tessa    Date: Jan 27    Category: Sharepoint    Views: 3745

I have customized a newform.aspx page for a list. The form has a couple of BDC fields, one of which I'm trying to set a default value. I have a javascript using jquery that sets the default value of several regular text fields but I cannot get the function to work with the BDC field. I have the following code:

function setDefault() {
var variety = "blue";

var elem = getBDCTagFromIdentifierAndTitle("TEXTAREA","Object Picker", 1);
if(elem) elem.value = variety;
var elem = getBDCTagFromIdentifierAndTitle("DIV","Object Picker", 1);
if(elem) elem.innerText = variety;


function getBDCTagFromIdentifierAndTitle(tagName, title, count) {
var tags = document.getElementsByTagName(tagName);
var myCount = 0;
for (var i=0; i < tags.length; i++) {
var tempString = tags[i].id;
if (tags[i].title == title){
if(count == myCount){
return tags[i];
return null;

This shows the value in the field, but when I save the form, the field does not save the value. My regular text fields that have a default value set do save, just not the BDC field. I've verified that the getBDCTagFromIdentifierAndTitle function does return valid objects and their value/innerText are indeed being set.

Any suggestions? is there a better way of setting the default value of a BDC field?
Moved byMike



1 Answer Found

Answer #1    Answered By: Latrice Henson     Answered On: Jan 27

After further investigation, it appears this is a known problem with custom forms and BDC fields. I will apply the hot fix as described in KB973409, support.microsoft.com/default.aspx/kb/973409?p=1

Didn't find what you were looking for? Find more on Set Default Value of BDC Field with Javascript Or get search suggestion and latest updates.