Nerfed Tech

October 21, 2008

How to create a label in a SharePoint survey

Filed under: Annoying, SharePoint, SharePoint 2007 — Folly @ 1:22 pm

This is not ideal. BUT, if you need to create a question that requires no answers, you can workaround there being no label field in sharepoint surveys.

1.  Use custom code / tool to programmatically create a SpChoiceField without choices, and switch the EditType to RadioButtons:

list.Fields.Add(”This is a label, no input options will be displayed!”, SPFieldType.Choice, False)

Dim choicefield As SPFieldChoice = list.Fields(”This is a label, no input options will be displayed!”)

choicefield.EditFormat = SPChoiceFormatType.RadioButtons
choicefield.Update()

I have tested this, it works.

2. Edit your ~\12\TEMPLATE\LAYOUTS\qstnew.aspx. Remove the javascript validation at line 1077 that checks for no choices. I have not tested this.

3. Maybe even create a new qstnew.aspx that does not validate the form input for no choices, and use that your self only.

Looking at all that….it’s almost easier to create a custom field…

Oh well.

Powered by WordPress