Powered by Blogger.
🌏World roaming Software Technology Evangelist. Proud Indian, Bought up from Coimbatore, Tamilnadu, INDIA. Pointing towards share of Knowledge. 😎
  • Programming ▼
    • DotNet
      • C# Coding Standards
    • Cloud
    • Microsoft 365/ SharePoint
    • SQL
    • Angular / ReactJS / NodeJS
    • Salesforce
    • Magento
    • Python
    • Mobile App Development
    • Database
    • DevOps
    • Automation Testing
    • User Experience
  • Learning ▼
    • Roadmap
    • Trainings
    • E-Books
    • Quick References
    • Certifications
    • Self Improvement
    • Productivity
    • TED Talks
    • Kids Programming
  • SW Engineering ▼
    • Agile
    • Software Design
    • Architecture Samples
    • Best Practises
    • Technologies and Tools
    • Open Sources
    • Free Softwares
  • Leadership ▼
    • Program Management
    • Product Management
    • Project Management
    • People Management
  • Job Search ▼
    • Interview Tips
    • Career Handbook
    • Resume Templates
    • Sample Profiles
    • Cover Letter Samples
    • HR Interview Questions
    • Job Websites List
    • Coding Site Links
    • TedEx Talks
    • International Jobs
  • Emerging ▼
    • Innovation
    • Machine Learning
    • Artificial Intelligence
    • Generative AI
    • AI Tools
    • Big Data
    • Data Science
    • Data Analytics & Visualization
    • Cyber Security
    • Microsoft Azure
    • Amazon Web Services
    • Cryptography
    • ChatBots
    • Internet of Things (IoT)
    • Mixed Reality /AR/VR
  • Misc. ▼
    • Travel
    • Photography
    • Health Tips
    • Medical Tips
    • Home Designs
    • Gardening
  • Samples ▼
    • GitHub
    • Executive Dashboard
    • Chatbot
    • Image Generator
    • Jay's Link Tree
  • Favourites▼
    • Saran Kitchen Hut
    • World of Akshu
    • Saran & Akshu - Other Links
Referred Link - http://sharepointdrive.blogspot.sg/2013/04/how-to-customizereplace-you-are-not.html



Survey Questions can be easily created on SharePoint 2010, where it is often required that no user fills the Survey twice. This can be easily achieved in OOB (Out of Box) fashion.

But the problem is that user sees the error message like the one shown below (Pic 1) which will definitely not look good on your Site and there is no easy way to change this.

There are many ways to fix this issue but the approach which i applied was on the client side Ecmascript method. As shown in the image on left we will be performing the following tasks.

  • Create a Link to Survey Question.
  • Include a CEWP on the page where the image having link to survey question will be shown.
  • The code in CEWP will checks if user has responded to survey earlier
  • Based on response Show either "Thanks for feedback :Image 2" or "Fill the Feedback: Image 1"
Ok so before we start this was the Error message we get if a user tries to fill the Survey again.(OOB way) but we dont want this screen to appear
How to get the Link to Survey Questions
  • Open the Survey List and get the code for replying to survey as shown below
  • Copy the code in a Notepad file. This will be looking somewhat like the below code.
?
1
2
<a accesskey="N" href="javascript:__doPostBack('ctl00$SPWebPartManager1$g_b76d52da_a06c_ 4545_bcb8_5f1ca8bddb99$ctl01$ctl0$toolBarTbl$RptControls$ctl00$diidIONewItem','');" id="someLonggggggggggId" onclick="javascript:NewItem2(event,'\u002f_layouts\u002flistform.aspx?ListId=\u00257B69901B7A\u00252DEE5C\u00252D4A24\u00252D9EF2\u00252DD3B39B5B4AE8\u00257D\
u0026PageType=8');return false;" title="Respond to this Survey"></a>
  • Now add the CEWP to the page where you want the user to click on the Image to Fill up the Survey. I have shown the below image as the link to survey in my example.
  • The image we will be showing after the user fills up the survey is (This image will not have any hyperlink)
  • So to do this transition we will put the below code in the CEWP
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
 
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
 
<script language="javascript" type="text/javascript">
    var namedListItem;
    var context = null;
    var web = null;
    var currentUser = null;
    var Author1 = null;
    var Author2 = null;
    var productcollection;
 
 
    $(document).ready(function () {
        ExecuteOrDelayUntilScriptLoaded(getWebUserData, "sp.js");
    });
 
   
    function getWebUserData() {
        context = new SP.ClientContext.get_current();
        web = context.get_web();
        currentUser = web.get_currentUser();
        currentUser.retrieve();
        context.load(web);
        context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
    }
 
   
    function onSuccessMethod(sender, args) {
            var userObject = web.get_currentUser();
            Author1 = userObject.get_title();
            Author2 = userObject.get_loginName()
            checkUserPresent();
      }
 
    function onFailureMethod(sender, args) {
            alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
               }
 
    
    function checkUserPresent() {
            var list = web.get_lists().getByTitle('FY12 ISD Staff Event');
            var query = "<View><Query><Where><Eq><FieldRef Name='Author'/><Value Type='User'>" + Author1 + "</Value></Eq></Where></Query></View>";
            var camlQuery = new SP.CamlQuery();
            camlQuery.set_viewXml(query);
            this.productcollection = list.getItems(camlQuery);
            context.load(this.productcollection);
            context.executeQueryAsync(Function.createDelegate(this, this.productsReceived), Function.createDelegate(this, this.failed));
         }
 
    
    function productsReceived() {
        var count = 0;
        var listEnumerator = this.productcollection.getEnumerator();
        //iterate though all of the items
        while (listEnumerator.moveNext()) {
            count = count + 1;
        }
        if (count == 1) {
            document.getElementById("demo").innerHTML = "<img class='ms-rteImage-1 ms-rtePosition-1' alt='Thanks for feedback' src='/PublishingImages/Team32.bmp'/>";
        }
    }
 
 
 function failed(sender, args) {
 
 }
</script>
 
 
<p id="demo">
<a title="Respond to this Survey" id="A1" accesskey="N" onclick="javascript:NewItem2(event,'\u002f_layouts\u002flistform.aspx?ListId=\u00257B69901B7A\u00252DEE5C\u00252D4A24\u00252D9EF2\u00252DD3B39B5B4AE8\u00257D\u0026PageType=8');return false;" href="javascript:__doPostBack('ctl00$SPWebPartManager1$g_b76d52da_a06c_4545_bcb8_5f1ca8bddb99$ctl01$ctl00$toolBarTbl$RptControls$ctl00$diidIONewItem','');">
    <img class="ms-rteImage-1 ms-rtePosition-1" alt="Budget Submission" src="/PublishingImages/Team32.bmp"></a></p>
So we will now never get the error message that the user has not registered becuse if the user is already registered then we will not show the hyperlink to the survey questions..
Newer Posts
Older Posts

Total Posts

Search this Site

Connect with Me

Translate Articles

Total Pageviews


Contributors

My photo
Jayavel Chakravarthy Srinivasan
Professional:I'm a Software Techie, Specialized in Microsoft technologies. Worked in CMM Level 5 organizations like EPAM, KPMG, Bosch, Honeywell, ValueLabs, Capgemini and HCL. I have done freelancing. My interests are Software Development, Graphics design and Photography.
Certifications:I hold PMP, SAFe 6, CSPO, CSM, Six Sigma Green Belt, Microsoft and CCNA Certifications.
Academic:All my schooling life was spent in Coimbatore and I have good friends for life. I completed my post graduate in computers(MCA). Plus a lot of self learning, inspirations and perspiration are the ingredients of the person what i am now.
Personal Life:I am a simple person and proud son of Coimbatore. I studied and grew up there. My mom and wife are proud home-makers and greatest cook on earth. My kiddo in her junior school.
Finally:I am a film buff and like to travel a lot. I visited 3 countries - United States of America, Norway and United Kingdom. I believe in honesty after learning a lot of lessons the hard way around. I love to read books & articles, Definitely not journals. :)
View my complete profile

My Achievements

My Achievements

My Favorite Links

  • Saran & Akshu Links
  • Saran Kitchen Hut
  • World of Akshu
  • Ashok Raja Blog

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Contact Form

Name

Email *

Message *

Blog Archive

  • ▼  2026 (37)
    • ▼  October (1)
      • Reliable Response Design Tips for User’s question ...
    • ►  September (2)
    • ►  July (1)
    • ►  June (6)
    • ►  May (7)
    • ►  April (7)
    • ►  March (7)
    • ►  February (5)
    • ►  January (1)
  • ►  2025 (65)
    • ►  December (4)
    • ►  November (3)
    • ►  October (3)
    • ►  August (1)
    • ►  July (6)
    • ►  June (7)
    • ►  May (26)
    • ►  April (1)
    • ►  March (3)
    • ►  February (1)
    • ►  January (10)
  • ►  2024 (134)
    • ►  December (3)
    • ►  November (8)
    • ►  October (11)
    • ►  September (2)
    • ►  August (1)
    • ►  July (39)
    • ►  June (8)
    • ►  May (4)
    • ►  April (9)
    • ►  March (6)
    • ►  February (33)
    • ►  January (10)
  • ►  2023 (16)
    • ►  December (12)
    • ►  August (2)
    • ►  March (1)
    • ►  January (1)
  • ►  2022 (14)
    • ►  December (1)
    • ►  August (6)
    • ►  July (3)
    • ►  June (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2021 (16)
    • ►  December (1)
    • ►  November (2)
    • ►  October (2)
    • ►  August (1)
    • ►  July (2)
    • ►  June (2)
    • ►  May (2)
    • ►  March (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2020 (36)
    • ►  December (1)
    • ►  November (15)
    • ►  October (2)
    • ►  September (1)
    • ►  July (1)
    • ►  June (2)
    • ►  May (4)
    • ►  March (2)
    • ►  February (6)
    • ►  January (2)
  • ►  2019 (14)
    • ►  December (3)
    • ►  November (1)
    • ►  September (2)
    • ►  August (1)
    • ►  June (1)
    • ►  May (3)
    • ►  March (2)
    • ►  January (1)
  • ►  2018 (61)
    • ►  November (3)
    • ►  October (4)
    • ►  September (4)
    • ►  August (5)
    • ►  July (4)
    • ►  June (4)
    • ►  May (7)
    • ►  April (7)
    • ►  March (5)
    • ►  February (1)
    • ►  January (17)
  • ►  2017 (55)
    • ►  December (1)
    • ►  November (7)
    • ►  October (7)
    • ►  September (8)
    • ►  July (4)
    • ►  June (7)
    • ►  May (4)
    • ►  April (4)
    • ►  March (1)
    • ►  February (2)
    • ►  January (10)
  • ►  2016 (45)
    • ►  December (1)
    • ►  November (5)
    • ►  October (2)
    • ►  September (7)
    • ►  August (3)
    • ►  July (3)
    • ►  June (1)
    • ►  May (3)
    • ►  April (5)
    • ►  March (3)
    • ►  February (3)
    • ►  January (9)
  • ►  2015 (88)
    • ►  December (5)
    • ►  November (2)
    • ►  October (6)
    • ►  September (6)
    • ►  August (3)
    • ►  July (6)
    • ►  June (7)
    • ►  May (12)
    • ►  April (6)
    • ►  March (11)
    • ►  February (10)
    • ►  January (14)
  • ►  2014 (159)
    • ►  December (16)
    • ►  November (13)
    • ►  October (42)
    • ►  September (12)
    • ►  August (19)
    • ►  July (3)
    • ►  June (17)
    • ►  May (10)
    • ►  April (12)
    • ►  March (7)
    • ►  February (4)
    • ►  January (4)
  • ►  2013 (192)
    • ►  December (7)
    • ►  November (2)
    • ►  October (3)
    • ►  September (10)
    • ►  August (25)
    • ►  July (17)
    • ►  June (22)
    • ►  May (22)
    • ►  April (24)
    • ►  March (17)
    • ►  February (22)
    • ►  January (21)
  • ►  2012 (204)
    • ►  December (21)
    • ►  November (35)
    • ►  October (47)
    • ►  September (27)
    • ►  August (6)
    • ►  July (21)
    • ►  June (16)
    • ►  May (7)
    • ►  April (9)
    • ►  March (4)
    • ►  February (3)
    • ►  January (8)
  • ►  2011 (70)
    • ►  December (8)
    • ►  November (5)
    • ►  October (3)
    • ►  September (2)
    • ►  August (7)
    • ►  July (3)
    • ►  June (30)
    • ►  May (3)
    • ►  April (3)
    • ►  March (1)
    • ►  February (3)
    • ►  January (2)
  • ►  2010 (30)
    • ►  December (1)
    • ►  September (4)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (4)
    • ►  April (6)
    • ►  March (5)
    • ►  February (2)
    • ►  January (5)
  • ►  2009 (40)
    • ►  December (4)
    • ►  November (6)
    • ►  October (4)
    • ►  September (5)
    • ►  August (4)
    • ►  July (3)
    • ►  June (4)
    • ►  May (8)
    • ►  March (1)
    • ►  February (1)
  • ►  2008 (6)
    • ►  December (1)
    • ►  September (1)
    • ►  May (1)
    • ►  April (2)
    • ►  February (1)
  • ►  2007 (7)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  July (1)
    • ►  May (2)

Recent Posts

Followers

Report Abuse

FOLLOW ME @INSTAGRAM

Popular Posts

  • Stay Wow - Health Tips from Sapna Vyas Patel
    Referred URL https://www.facebook.com/sapnavyaspatel WATCH WEIGHT LOSS VIDEO: http://www.youtube.com/ watch?v=S_dlkjwVItA ...
  • Calorie Count chart For food and drinks
    Referred URL http://deepthidigvijay.blogspot.co.uk/p/health-diet-calorie-charts.html http://www.nidokidos.org/threads/37834-Food-Calorie-...
  • SharePoint 2010 Interview Questions and Answers
    Referred URL http://www.enjoysharepoint.com/Articles/Details/sharepoint-2010-interview-questions-and-answers-148.aspx 1.What is SharePoint...
  • 150 Best Windows Applications Of Year 2010
    Referred URL : http://www.addictivetips.com/windows-tips/150-best-windows-applications-of-year-2010-editors-pick/?utm_source=feedburner...
  • Web Developer Checklist by Mads Kristensen
    Referred Link -  http://webdevchecklist.com/ Web Developer Checklist Get the extension  Chrome  |  Firefox  |  Edge Menu Bes...
  • WCF and REST Interview Questions
    What is WPF? The Windows Presentation Foundation (WPF) is a next generation graphics platform that is part of...
  • Remove double tap to unlock feature on samsung galaxy core2
    Double tap to unlock is a feature of Talkback, so if your will disable Talkback, double tap to unlock will also be disabled. To disable doub...
  • Difference Between Content Editor and Script Editor webpart
    Referred Link -  http://jeffas.com/content-editor-vs-script-editor-webpart/ Content editor web part is a place holder for creating rich ...
  • SPFolder related operations in SharePoint
      1) Get SPListItem(s) of a particular SPFolder SPList splist; SPFolder spfolder; //Get the required folder instance SPQuery spquery = new ...

Comments

Created with by BeautyTemplates | Distributed by blogger templates