Monday, January 24, 2011

Javascript & Read-Only Picklists

So you've got this great bit of Javascript that changes a read-only picklist field. Great! The only problem is, when the code fires on an update form, the picklist that you set doesn't get saved! It'll work on create, so whats the deal?

What you need to do is go back into your Javascript and enable the "ForceSubmit" attribute of the picklist. For example (from CRM 2011, changing one picklist based on the value of another picklist onchange):

function CheckType() {
  if(crmForm.all.new_type.DataValue == 100000001) {
    crmForm.all.new_readonlypicklist.DataValue = 100000001;
    crmForm.all.new_readonlypicklist.ForceSubmit = true;
  }
}

Your picklist field should now update and save properly!

No comments:

Post a Comment