Hot answers tagged

10

Why do you need mappings First things first: let me explain, why do you need to use mappings at all. With some accuracy it can be said, that a Choice field in SharePoint represents a DropDownList control. And in the ASP.Net DropDownList control, each item (ListItem, to be precise) has two essential properties: Text and Value. Obviously, Value property acts ...


8

You could use a unicode character that does not print anything. I tried it with U+205F and it seemed to work as expected. To put this character in, open up the charmap (Start->Run->charmap) on your machine, then select a font that has unicode support (I chose calibri), scroll almost to the bottom and find the U+205F. You can then double click the ...


6

Looks like you're using default Update method of SPContentType when updating your content type in feature updating receiver. To push changes to all inherited list content types, you should use another overload of the Update method, and pass true to it: contentType.Update(true); Description of the parameter from MSDN: updateChildren Type: ...


5

You can do it in InfoPath, cascading drop downs. But since you said you need to do it in jQuery, there is a very useful library, called SPServices, available to assist. Marc has created a function in the library to do cascading drop downs, which is exactly what you want. Look over that information and see if it's helpful.


5

Choice fields are returned with a Value without the need for expansion: Example: IP_WorkflowStatus = IP_WorkflowStatusValue Here is an example of a query without using expansion: $filter=IP_WorkflowStatusValue eq '2-Validated' If you want to use expansion, then you need to use expanded field notation Relation/Field: $filter=IP_WorkflowStatus/Value eq ...


3

It is not supported for multiselect fields (i.e. fields represented in the normal UI as check boxes). The following quote is for 2013 but the same rules apply for the ListData.svc. You can filter on the client side, though, depending on how you represent the data and the controls you use. Queries for multi-value lookup fields and users Because ...


3

Just create the Choice field as a drop down list with the only option of Yes and set no default value. When an item is submitted an empty value will be set in the list. If a user sets the field and wants to revert back to no value, they'll be forced to go into datasheet mode to remove the selection. THe regular editform will not give them a means to ...


3

You can find details about <Mappings> in [MS-WSSCAML]: Collaborative Application Markup Language (CAML) Structure Specification V0.1 "MAPPINGS: A set of MAPPING string elements that represents a canonical, languageagnostic identifier for a corresponding CHOICE with the value specified by the MAPPING element. The reader MUST ignore MAPPINGS if the ...


3

SPFieldChoice has a property named FieldRenderingControl. Using reflector you can find this code in the FieldRedneringControl property: .... switch (this.EditFormat) { case SPChoiceFormatType.Dropdown: control = new DropDownChoiceField(); break; case SPChoiceFormatType.RadioButtons: control = new RadioButtonChoiceField(); ...


3

All credit goes to Xiang Zeng for providing the answer, many thanks! This is a bug in Sharepoint. However, there is a workaround. Directly modifying the SchemaXml property to change the choices is allowed: public override void ItemAdding(SPItemEventProperties properties) { base.ItemAdding(properties); string itemTitle = ...


3

The only solution not involving code is: Create the column as: Choice Not required Unique Choices: 1, 2, 3, 4 and 5 (not None) Drop-Down Menu Clear default value That'll allow the users to create any number of entries without a priority, but only one for each of the 5 values. This seems is like you want it to work. BUT once an entry has been assigned ...


3

You can use the GetFieldValue method of the field class if you are unsure of the actual type of the underling value. For example: item["MyChoiceField"] = listIstance.Fields["MyChoiceField"].GetFieldValue("Choice1");


3

Descerning the original values from the user filled-in is easy, as the additional values entered by a user are not added to the original choice field definition, which will remain unaltered. So, in order to retrieve all the list items where the choice field value is not one of the predefined values, you need to build a CAML query with the NEQ operator on ...


3

Multi-choice field values are stored internally in ArrayList How to get multi-choice field values in PowerShell $web = Get-SPWeb $Url $list = $web.Lists[$ListTitle] $item = $list.GetItemById($ItemId) $values = new-object Microsoft.SharePoint.SPFieldMultiChoiceValue($item[$fieldName]) //print multi-choice field values for($i=0;$i -lt $values.Count;$i++) ...


3

Try this $(document).ready(function(){ $('#ctl00_m_g_de548742_27f6_4e71_b3ec_2d9a1ecca117_ff151_ctl00_DropDownChoice').on('change', function(){ var accountType = this.value; if(accountType == 'Military') { $('.milShow').show(); $('.ctrShow').hide(); $('.civShow').hide(); } ...


3

This should do it: Download jQuery and save it to /SiteAssets/ Create a JavaScript file named comma-break.js and save it in /SiteAssets/ with the contents of: $(document).ready(function () { var str = $('.ms-listviewtable').html(); //; $('.ms-listviewtable').html(str.replace(new RegExp(", ", "g"), ",</br>")); }); Add a Content Editor ...


2

I have seen this happen before (when a programmer without SharePoint knowledge 'fixed' a problem with imported/pasted data and emptied/deleted the existing definition of DropDown values The underlying database stores anything that is written to it, so modern JSOM code can write values to a 'DropDown' field without checking those values actually match with ...


2

You can't do it like this because Lookups are internally based on reference-ids and not the values. As Formulas can not expand these complex types (same applies to: Multiple Select, [Me] and Person Columns) you can not use them in Calculated Columns Your workaround is to use Workflows to read the Complex type value and write it to a basic Text column, ...


2

You will need to create the structure using SPServices.CascadeDropdowns like 404 said. Also make sure you have the fields that you want auto-populated set up as required fields. If they are not required and for some reason don't want them required you can do the following (I would recommend requiring the fields, I just wrote this out before that crossed my ...


2

I've done what Unnie describes above before. First you create a list and populate it with all your choice values. Then you configure your list people will add items to by creating a new column of type lookup that points to the list you just created using the Title column. You set it to allow fill in votes. Then in a workflow, you check if a fill in option ...


2

If you must avoid creating WFs or event handlers, then another option is to use a Calculated field with bunch of new columns (AssignedOn, TimeToInProgress, etc.). For the first duration: time taken to change from Assigned to In Progress The first time the user changes the status of the document to Assigned set the AssignedOn column to current date and ...


2

There isn't that functionality out of the box, but it can be done with custom javascript or editing the forms with InfoPath.


2

Yes this is possible. You can make 3 Calculated columns to spit out the number value of each of the three columns you talk about, and then have the 4th Calculated column use those values. Or You can make a long formula for your 4th column to first determine the corresponding value of "High", "Medium", "Low" for each column before multiplying the ...


2

If you have pairing defined, you can use mapping method: var map = new Object(); // or var map = {}; map[myKey1] = "subCat1,subCat2"; map[myKey2] = "subCat3,subCat4"; function get(k) { return map[k]; } //Attach event with dropdown selector, of main category. $("#categorySelectorId").change(function(){ var subCategory = $("#subCategorySelectId"); ...


2

From my experience this will have to be done programmatically. Add a new managed metadata column manually then write a console app or PowerShell to loop trhough the items/documents and match the selected value with the managed metadata equivalent. Then do a SystemUpdate(false) on the item (the false part will preventing the version from being increased) ...


2

What you are looking for cannot be done using event handlers. You need to use selected index changed event of the dropdown control in your form pages.


2

SPServices has a method for this: The SPArrangeChoices rearranges radio buttons or checkboxes in a form from vertical to horizontal display to save page real estate. The documentation is here: SPServices.SPArrangeChoices


2

There are a couple ways you can do this but they aren't really "out of the box" because these are your own custom rules. Add some JavaScript to your New/Edit forms If you are familiar with JavaScript, this is probably the easiest method since you don't need to deploy any code to the server. You can edit the forms to use jQuery or Prototype.js + ...


2

In the end I have followed the direction proposed by Stuart and marked this still another SharePoint blackhole, so I have left any hope of using this CAML tag as last for now. During my research I had a look at many classes in the framework but I cannot find anything related to using the mapping "attribute", so I can only assume that it was an uncompleted ...


2

Where "spfc" is an object of type SPFieldChoice: int year = DateTime.Now.Year - 5; for (int i = 0; i < 10; i++) { spfc.Choices.Add((year + i).ToString()); } spfc.Update();



Only top voted, non community-wiki answers of a minimum length are eligible