Sunday, 29 July 2012

Align Survey Radio Buttons horizontally


Using jquery to align the radio buttons in survey horizontally in SharePoint 2010.

Pre-requisites:
We need the following jquery libraries: 
1) jquery-1.7.2.min.js
2) jquery.SPServices-0.7.1a.min.js

Download the above jquery libraries & save them in your site.
Open the Survey NewForm.aspx page in browser & add the following script in the CEWP.

<script type="text/javascript" src="LocationPath/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="LocationPath/jquery.SPServices-0.7.1a.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$().SPServices.SPArrangeChoices({

    columnName:"Radio Button",
    perRow:3
});

$().SPServices.SPArrangeChoices({
    columnName:"Radio Button 2",
    perRow:5
});

});
</script>
 

where,
columnName: Refers to the display name of the column
perRow: Represents number of radio buttons to be displayed on each row. 
Note: Highest number of radio buttons that can be displayed in one row is 99.


No comments:

Post a Comment