I have a document library with two lookup columns. Column A is "Region" with the following choices:

  • North
  • South
  • East
  • West

Users can select more than one region when uploading a document.

Field B is "States" with the following choices:

  • Florida
  • Georgia
  • California
  • Washington
  • North Carolina
  • South Carolina

I am trying to add JavaScript to the newform.aspx and editform.aspx pages that will automatically add the corresponding states after a region is selected. Example:

User adds "South" as a choice in the "Region" field. "Florida" and "Georgia" are automatically added to the "States" field.

Logically, I imagine it to read like this:

if value of Region contains "South" { value of "States" = " + Florida + Georgia" }

Clearly, I am not familiar enough with JavaScript or the CSOM to know how to write a statement that will update field B based on choices selected by the user in field A. Any help would be appreciated!

  • these are called Cascaded columns and you can google for this term to find answers – Arsalan Adam Khatri Aug 18 '15 at 9:11
  • I am familiar with cascading columns, but that is not the solution I am looking for. I want the values in the second column to automatically be selected, not just available based on the first column. Does that help clarify? Thank you for the suggestion! – Cornbread06 Aug 20 '15 at 5:54

did you think about workflow that will put values you want to the second field? Exp. If South is chosen, update item/set field status at the States field to Georgia elseif west set field status States to California, and so on..

| improve this answer | |
  • I have, but I would really like to do this with JavaScript on the form page. If I use a workflow, the user won't know the states were added until after they submit the doc to the doc library. I would like them to be able to see the changes on the form before they submit. Not to mention, I want to give them the option to remove some of the "States" that were automatically added, if they don't need all of them...I appreciate the suggestion, though! – Cornbread06 Aug 20 '15 at 5:56
  • its clear now :) sorry for misleading with an answer. – Danilo Aug 20 '15 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.