문제

I added a choice field "IsMainframe". Business unit only want Blank and Yes. How do I incorporate blank in a choice field?

도움이 되었습니까?

해결책

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 character and it will place it in the textbox below. You can then copy that value and put it in a choice field option and it will appear as blank to the user.

EDIT: Make sure you also put it in as the default value, otherwise you will get three choices (NULL, U+205F, and YES). Also, if you have any existing rows in the list, you will see three choices if the row has a null value currently assigned.

Charmap Screenshot

As you can see the test column now appears to have a blank option.

Dropdown screenshot

다른 팁

  1. Go to the column drop down list in question.
  2. At the first entry on the list do a return to create a blank space.
  3. Inside that blank space place your cursor and press and hold down the ALT key while typing 0129 on the NUMERIC KEYPAD. This will enter another type of “blank character” that SharePoint cannot wipe away.
  4. In the Default Entry setting do the same.
  5. Save and you are done.

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 deselct the only value in the list.

You could use some jQuery to set it back to empty. Here's a basic example.

<script type="text/javascript">
$(document).ready(function(){
 $("[title$='YourDDLColumn'] option:selected").val();
});
</script>

You'll probably want to wrap it in some sort of click function or wrapped in logic that checks for a query string value to exist.

Alternatively you could create it as a Yes/No field with the default value being No (unselected). It would save into the list as No, not a blank value though.

The Right Way To Do This

Using: SharePoint2013
Current Answer Not Acceptable
I've seen several answer similar to the above. Everyone saying use ALT0129 or the blank font character. I found these workarounds unacceptable because they would create a disconnect from the default SharPoint column filter (Empty) and instead create a new check box that is just blank.
enter image description here
This is because the field is still holding a character and is not truly empty. Which causes more work because anything else you setup, like views have to account for this blank character. Even if a user is just doing a simple filter on the column they will need to know that they have to check (Empty) and the blank value to get all the empty fields.

A Better Way
I spent two days on and off looking around the internet and was about to give up, when I was looking through the ASCII character sets and came up with this solution.
First clear out your list of any of the blank entries(the space or the ALT0129) characters, leave the list with the actual values you want in it.
Now switch your Deafult value setting to Calculated Value and enter CHAR(127) in the field. This value is akin to Delete on the character map, thus it enters no actual character hidden or otherwise and only creates one blank value in the drop down list, which for some reason the other online methods I've tried create two blank fields in the list.
Once you fix that just go to your list and update your records. I would suggest just filtering all those blank answers and using the Edit to do a mass change. Set the first one then just drag from there. Once you replace all the blank character values, you'll see the blank column filter is gone and you will just have the SharePoint (Empty) default one.
enter image description here

Note: Please note I had to update this post. I can't remember why I had put CHAR(160), but I ended up using CHAR(127). I may have just been in a rush when typing this up.

--cubesmind

Take look at second answer (no up votes @MarcelBernards) to this StackOwerflow question:

blank option in drop down disappears from custom Sharepoint list

I was exploring similar possibilities when I stumbled across it. Didn't test it myself but I think it is worthwhile.

Edited:

There is also alternative: You can use standard Yes/No field and write custom event handler to convert No value of your field to null (eg. on ItemAdding and ItemUpdating). Sure this is overkill but if you really need it...

Probably no help but this could be done as a lookup to another (very short) SP list, with 'Yes' in the looked up column. Yes can then be selected but it's also possible to delete it to be blank.

We had an issue where users had selected values in a choice field and wanted to clear them out. Even though the field was not defined as mandatory, you couldn't delete the value in the normal item editing screen, or in datasheet view, or editing the list as a linked table in Access.

I ended up writing a small SharePoint 2010 workflow attached to the list, and adding it to the item menu. A workflow step won't let you set the value of the field to null either, but it will let you set the field to the same value as another field in the record. I picked a field that was empty as the source for setting the value and that worked to clear out the choice field selections.

Convert the choices to check boxes, and then you can uncheck if needed.

I had the similar issue and did not want to implement CHAR(127). In my case one of the columns was showing the blank option and the other was not. I compared the SchemaXML but they were identical. Finally I added the column to a new list. It showed the blank option. Long story short, some how SharePoint keeps info about the column even-though you delete it. So I had to re-create the list to solve this problem.

hope it helps...

I was unable to find a good way to do this even with using the character maps. I ended up deleted the option in quick edit mode to leave the field blank

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top