Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
    
I would just tell the business unit to reconsider their request and use a more explicit option, considering that SharePoint doesn't handle blanks. –  Christophe Sep 10 '11 at 4:35

3 Answers 3

up vote 5 down vote accepted

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

share|improve this answer
    
+1 I tested this and it works. Nice! –  Vedran Rasol Sep 13 '11 at 21:17
    
I copied and pasted the blank in the choice; but I still see "Yes" to be the only option. –  Mary Rivers Sep 14 '11 at 20:30
    
Did you try this on the EditForm? because by default a blank will appear with Yes in the NewForm. –  Mary Rivers Sep 14 '11 at 20:36
    
I was testing on a document library, where it worked as expected. I tried it on a normal list and I am seeing what you are seeing. It seems to be if nothing is selected (the value is null) it will have a spot to allow you to keep the null value. Once you select a value, then it will only allow you to select from valid choices. –  John Koerner Sep 16 '11 at 0:18
    
I am so positive i am doing something wrong. Please see the link for the column setup screen and editform screen shots. imageshack.us/photo/my-images/17/setupcolumn.png imageshack.us/photo/my-images/833/editornewformresult.png –  Mary Rivers Sep 16 '11 at 13:59

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.

share|improve this answer
    
@Eric: That's exactly I have it. But user accidentally picked "Yes" from the choice box and were not able to go to back to blank. (Business unit dont want Y/N bool field type. They just want blank and Yes). –  Mary Rivers Sep 9 '11 at 20:02
    
Rather than having an empty choice, you could have a string called 'null', or 'blank'. That would mean the user didn't make a selection. –  Tim Gabrhel Sep 9 '11 at 20:06
    
Only problem, they (business users) only wants to see blank (null) or Yes. –  Mary Rivers Sep 12 '11 at 16:20
    
I've tested my example above, Choice column, no default value with Yes as the only option. On my NewForm and EditForm, the default value is blank and when the drop down is activated, there is a blank line then Yes. –  PirateEric Sep 12 '11 at 16:25
    
@Eric: you are correct. default is null. sometime biz users accidentally picks Yes and then wants to go back to Null or blank and that's what I am trying to accomplished. –  Mary Rivers Sep 13 '11 at 14:35

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...

share|improve this answer
    
How would filters handle this? –  Christophe Sep 10 '11 at 4:36
    
@Christophe - filters would not act as expected. You would have 2 options [nothing] and Yes, and default (empty) option would return nothing. –  Vedran Rasol Sep 10 '11 at 15:13
    
I tried 129 or 81 but SP shows them as 129 or 81. Unless I have to put it in a right format. –  Mary Rivers Sep 12 '11 at 16:14
    
I added U+205F and Yes to the choices and it shows up as U+205F and Yes. I dont see blank or Null –  Mary Rivers Sep 15 '11 at 15:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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