Archive

Archive for the ‘SharePoint’ Category

A more advanced Survey List in SharePoint 2013

July 5, 2016 Leave a comment
Hi everyone!

My customer has asked for a solution to evaluate developped applications by the end users. A solution based on Survey template was proposed but the default template is just a form with the questions as fields. The interface is not convivial if we have a long survey!

Let us assume that we have a survey with three questions. The following pictures shows the default NewForm:

Survey11

Enter a caption

What is the difference between a custom list and a survey then? Some interesting features can be cited:

  • The stats part to evaluate the survey.Surevey12
  • The branching feature in the survey that allows to jump to a given step based on what is chosen by the user at the current step.Surevey13

Now, let us develop a more advanced survey using just javascript! We want to achieve these objectives:

  • View just one question at a given step
  • Two buttons to access to the next or the previous question
  • View the Finish button once the user has finished the survey
  • Confirm the answers before saving

3 libraries will be used for different purposes:

  • SP.js for notifications.
  • SPUtilies.js for hiding and showing the questions.
  • JQuery for SPUtilities.

Simply we will write a custom html file that will be referenced into a Content Editor WebPart added on the page NewForm.apsx of your survey:

Survey14

Here is the content of the Quiz.html:

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- Javascript files references -->
    <script type="text/javascript" src="/JS/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/JS/sputility.min.js"></script>
    <script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
    <script type="text/javascript" src="/_layouts/15/sp.js"></script>
<meta charset="utf-8" />
    <title></title>
</head>
<body>
    <!-- A table containing the Next and Previous buttons -->
<table class="ms-rteTable-default" cellspacing="0" style="width: 100px;">
<tbody>
<tr>
<td  style="width: 100px; height: 20px;">
<div id="Previous"><<<</div></td>
<td  style="width: 100px; height: 20px;">
<div id="Next">>>></div></td>
</tr>
</tbody>
</table>
<script language="javascript" type="text/javascript">
        //A variable to keep the current position in the survey
        var i = 0;
        //An Arry to store the list of the questions fields
        var fieldsArray = [];
        //This functions is invoked when we click on Finish Button
        function PreSaveItem() {
            var fields = SPUtility.GetSPFields();
            var message = 'Are you sure to save these answers ?\n';
            for (fieldName in fields) {
                message = message + fieldName + ' : ' + 
                SPUtility.GetSPField(fieldName).GetValue() + '\n';

            }

            if (confirm(message)) {

                return PreSaveAction(); // allow save form...
            }
        };
            //Notify the user
            function PreSaveAction() {
                SP.UI.Notify.addNotification('Your Answers are being saved...', 
                                             false);
                return true;
            };
            $(document).ready(function () {
                //Hiding the form toolbar
            $('.ms-formtoolbar').hide();
            var fields = SPUtility.GetSPFields();
            for (fieldName in fields) {   
                //Get the questions list
                fieldsArray.push(SPUtility.GetSPField(fieldName));
                //Hide all question
                SPUtility.HideSPField(SPUtility.GetSPField(fieldName));
            }
                //Show the first question
            SPUtility.ShowSPField(fieldsArray[0]);
            });
        //Next handler
            $("#Next").click(function () {
                //Hide the current question
            SPUtility.HideSPField(fieldsArray[i]);
            
            if (i < fieldsArray.length-1) 
            {                 
                i++;             
            }             
            else             
           {                 
           //Show the form toolbar when we reach the last question                 
            $('.ms-formtoolbar').show();             
            }             
            //Show the next question             
            SPUtility.ShowSPField(fieldsArray[i]);                      
            });         
            //Previous handler         
           $("#Previous").click(function () 
           {             
             //Hide the current question             
             SPUtility.HideSPField(fieldsArray[i]);                          
           if (i > 0) {
                i--;
            }
            //Show the previous question
            SPUtility.ShowSPField(fieldsArray[i]);

        });
    </script>
</body>
</html>

Let us see the results!

Oh yes, the buttons Next and Previous allow you to navigate between the questions:

First Question:

Survey15

Second Question:

Survey16

Thrid Question:

Survey17

Now if we clic on the Next button the Finsih button is shown:

Survey18

Before saving the answers a confirm window is launched to confirm the answers:

Survey19

Finally, a notification label dispalys the message of saving the answers:

Survey20

Ok that’s all! Hope it helps!

 

Advertisements

After Forefront family, Inforpath will also die!

February 1, 2014 Leave a comment

infopath-151x157

Hi again!

Strange decisions Microsoft is taking but not really, this time, about InfoPath technology as we are working on a Next Forms Technology!

Just few hours ago, Microsoft announced that this beautiful technology is knowing its end of life!

This decision concerns the Client Inforpath and InfoPath Service Applications on SharePoint Server 2013 and Office 365 SharePoint OnLine.

Just wait for the SharePoint Conerence Event coming next month inchaEllah to discover the Next InfoPath Technology.

Categories: SharePoint Tags:

Gradual Site Delete Job definition in SharePoint

August 30, 2012 Leave a comment

Hi,

This post is interesting for the SharePoint administrators working on SharePoint 2010 or 2013.

As you know SharePoint sites (as all ECM systems) and their contents are stored into SQL Server tables.

If you intend to delete big collection sites, this involves sql deletion requests expressed into stored procedures.

SQL server defines some rules like those related to locks ad their escalation according to the treated data amount. So if the collection site that should be deleted is so big so the numbers of rows to be deleted is consequently also big. In this case the locks can freeze your SQL Server and all related SharePoint sites.

To optimize the deletion operation, an obvious solution was introduced in SharePoint 2010 and consists of deleting in the first time logically the site and after that gradually deleting the site contents.

this is done via the Gradual Site Delete Job definition.

By default, every day this job is executed and deletes 1000 rows of the site collection content database.

Q:But how to invoke it?

R:How to do that without PowerShell?

You have just to execute the following command : Remove-SPSite  -Identity “URL” -GradualDelete

Even your site collection is not big, try to use this method to avoid your infrastructure disruption.

SharePoint 2013 Themes

July 31, 2012 Leave a comment

without a long wait, I installed SharePoint 2013 on Windows Server 2012 and I was so impatient to discover its new functionalities.

The first attractive thing is the Metro look of SharePoint 2013 and the available themes for  a simplified Site branding.

If you are not friendly (as me, lol) with HTML and CSS, SharePoint 2013 themes can rescue your life to develop so awesome sites.

Can you recognize this SharePoint site honestly?:

To change the style you have to click on “What’s your style?” or click on the settings button.

By default, 14 themes are available:

When your theme is chosen, you can modify some parameters like the background image, the site layout, etc:

Finally, your site is updated with the new theme:

Really SharePoitn is becoming wonderful. I will continue my discovery adventure…

The new SharePoint 2013 introduction by a video

July 30, 2012 Leave a comment

SharePoint 15 seems to have many changes from the previous version.

I d’like to share with you this great video to learn about the new features:

Other videos are also available on this link that describe all SharePoint 2013 features.

SharePoint 2013 is … HERE!!!

July 30, 2012 Leave a comment

Hi,

It’s too late to announce this great news, but it’s good to know for the SharePointers; SharePoint 2013 is available for you to test its new functionalities.

You can download it from this link.

The SharePoint Designer 2013 is also here.

For the hot readers, an interesting book of more than 400 pages is  available from this link.

InchaEllah, I will install it at once to discover my lovely SharePoint.

 

SharePoint 15 with Yammer?

June 15, 2012 Leave a comment

yammer-logo_ps2 Microsoft will probably buy Yammer. Yammer is the Entreprise Facebook that allows the Entreprises to build their own Private social networks. Yammer has already developed a solution to integrate into SharePoint sites and involve the out of the box social features.

After Skype, I am waiting for a better integration between Skype, Lync, Exchange, SharePoint and finally Yammer. In this case, Microsoft, will continue to provide the known services but with a better integration, SharePoint can be easily chosen a good solution to use Yammer.

Recently, I have searched for the new features of SharePoint 15, I didn’t find amazing things but perhaps Yammer will be one of the surprises!