SharePoint Class Registration Form

Introduction

This walkthrough shows how to build an automated registration form that closes down registration if the seats in the class fill up.

Here’s an example of what the result will look like:

Class Registration Form Example

Create Lists

This solution requires two lists, one containing the classes and another one containing the registrations.

Class Calendar

The class calendar list holds the classes and informations such as the remaining seats.

Type: Calendar

Fields:

  • Seats
    • Type: Number
  • FilledSeats
    • Type: Number
  • ReaminingSeats
    • Type: Calculated
    • Formula: =Seats-FilledSeats
    • Data type returned: Number
  • SeatsIncrement
    • Type: Calculated
    • Formula: =FilledSeats+1
    • Data type returned: Number
  • Closed
    • Type: Yes/No
    • Default value: No
  • StaticID
    • Type: Number
    • Note: This is a Hack we have to put in because we can’t use the real ID field in a calculated column. We will use a workflow to fill it in correctly later. I am open to suggestions on a better way to do this.
  • Register
    • Type: Calculated
    • Formula: =IF(Closed=TRUE;"Closed for registration";IF(ReaminingSeats>0;CONCATENATE("<a href='#' onclick='OpenRegistrationForm(";StaticID;")'>Register</a>");"Class is Full"))
    • Data type returned: Number
    • Note: You might have to replace the semicolons with commas as this seperater depends on the SharePoint localized installation.

Class Calendar view

In order to register for an class we need a custom view.

Type: Default view

Option: Make this the default view

Columns:

  • Title
  • Location
  • Description
  • Start Time
  • End Time
  • Seats
  • RemainingSeats
  • Register

Class Attendees

This list contains the registration every entry shows the attendee and the chosen class ID.

Type: Custom List

Fields:

  • Username
    • Type: Single line of text
    • Option: Required
  • Meeting
    • Type: Lookup
    • List: Class Calendar
    • Field: Title
  • MeetingID
    • Type: Single line of text

Create Workflows

SetStaticClassID Workflow

The SetStaticClassID Workflow is really a hack because SharePoint won’t let you use the ID field in the calculated columns. All we are doing is setting a number field with the ID field every time the calendar item is created or modified.

  1. Open the Class Calendar in SharePoint Designer
  2. Add a list workflow
  3. Name it: SetStaticClassID
  4. Update Start Options: Start Workflow automatically when an item is created and Start workflow automatically when an item is changed
  5. Add an action: Set Field in Current Item
  6. For field link choose: StaticID
  7. For value link click on the fx button
  8. Data source: Current Item
  9. Field from source: ID
  10. Save and publish

Registration Workflow

The Registration Workflow is one of the main parts of this solution. This is the Workflow that will update the remaining seats in the calendar list when an Attendee register for the course.

  1. Open the Class Attendees list in SharePoint Designer
  2. Add a list workflow
  3. Name it: Registration
  4. Update Start Options: Start Workflow automatically when an item is created
  5. Add an action: Update List Item
  6. Click the “this list” link in the action
  7. Change the list ot the Class Calendar list created earlier
  8. Click the “Add” button
  9. Choose “FilledSeats”
  10. Click the fx button
  11. Data source: Class Calendar
  12. Field from source: SeatIncrement
  13. Field: ID
  14. Click the fx button
  15. Data source: Current Item
  16. Field from source: MeetingID
  17. Close all dialogs until you get back to the “Update list Item” dialog by clicking on ok
  18. In the same dialog in the Find the list item section choose for Field: ID
  19. Click on the fx button
  20. Data source: Current Item
  21. Field from source: MeetingID
  22. Click ok
  23. Save and publish

Create InfoPath Form

The end user will eventually register through the InfoPath form on the Class Attendees list.

  1. Open the Class Attendees list InfoPath form
  2. Right-click on the Title entry field and select Text Box Properites
  3. Click the fx button on the default value filed
  4. Add this for the formula concat(Username, " registration for event number ", Meeting)
  5. Add a fomratting rule to the Title and MeetingID field
  6. Check “Hide this control” foreach formatting rule
  7. Move the filed Title and MeetingID to the bottom of the form as the will be invisible.
  8. Add a formatting rule to the Username and Meeting field
  9. Check “Disable this control” foreach formatting rule
  10. Right-click on the Username entry field and select Text Box Properites
  11. Click on the fx button for the default value
  12. Add this formula username()
  13. Select the Meeting entry field
  14. In the Properties tab click the “Default Value” button
  15. Click the fx button on the default value field
  16. Insert the MeetingID field
  17. Delte the Attachments field
  18. Publish the form

Querystring

In order to automatically set the the meeting in the InfoPath form, we will use a query string to the MeetingID field.

  1. Open the Class Attendees list
  2. Select the List tab > Form Web Parts > (Item) New Form
  3. Add a Query String (URL) Filter webpart
  4. Updat the “Query String Parameter Name” with meeting_id in the webpart properties
  5. In the webpart options select Connection > Send Filter Values To > InfoPath Form Web Part
  6. Select the MeetingID field as Consumer Field Name
  7. Save the changes

Add JavaScript

The javascript creates the dialog box javascript to open our new form. The call to this javascript method is in the calculated field on the attendees list to register.

  1. Open the SharePoint site were you are going to display the Class Calendar list webpart
  2. Edit the page and select Embed Code on the Insert tab
  3. Paste the following javascript and save the page
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.0/jquery.min.js">
// visit http://www.jsdelivr.com/#!jquery to update the cdn url
</script>
<script type="text/javascript">
function OpenRegistrationForm(meeting_id){
    var options = {
    // to geht following make a right click on the new item link in the Class Attendees list and select open in new tab.
    // Now copy the url in the browser from the beginning to the of the &RootFolder= part
    // Inser the link below and replace [RootFolder] with meeting_id
    url:"http://sharepoint.vbl.ch/Personal/Lists/Class%20Attendees/Item/newifs.aspx?List=21803ee2-66ab-4df2-9116-b02853ca7e1a&meeting_id="  + meeting_id,
    width: 750,
    height: 600,
    dialogReturnValueCallback: DialogCallback
  };
  SP.UI.ModalDialog.showModalDialog(options);
}
function DialogCallback(dialogResult, returnValue){}
</script>

Finally

Now we got everything required to set up our Class Registration Form.

  1. Open the SharePoint site were you are going to display the Class Calendar list webpart
  2. Add the Class Calendar list webpart
  3. Edit the webpart and select the Registration view
  4. Add a class example
  5. Now you should be able to register for classes by click on the registration link.

Source

SharePoint Calculated Columns By Andy Wessendorf
SharePoint 2010 Class Registration Form
Enable clickable urls in calculated fiels)

77 Replies to “SharePoint Class Registration Form”

  1. Hello, I did exactly step by step but somehow I cannot get the final Hyperlink working and simply all the times receive “Register
    any clue what Im doing wrong please?

    1. Hi, the link should look like this:

      Register

      It’s important that the returned data type for this calculated field is a number, otherwise the link won’t be displayed as “Link”.

      Be aware that you can’t open the register link in the Class Calendar list. You have to display the register view of the class calendar as web part and add the piece of javascript to the same page.

      Only the javascript will make the link “clickable”.

      In your case I’m quite sure that you have chosen the wrong return datatype for the register field.

      1. If this return type is everything else than number SharePoint 2013 wont’ display the content as actual link.

      2. Janik, thank you for your reply! Appreciated!
        you were absolutely right! I missed that one. When I changed it to number it is clickable. Im olmost there however I have some issues with JAVA

        any clue please? THANK YOU
        here is my code….

        function OpenRegistrationForm(meeting_id){
        var options = {
        url:”http://my.abc.com/sites/RBCCI/Lists/Attendees/Item/newifs.aspx?List=6614640d%2Dca81%2D4bbe%2D99b3%2D1762d52676bf&meeting_id=” +meeting_id,
        width: 750,
        height: 600,
        dialogReturnValueCallback: DialogCallback
        };
        SP.UI.ModalDialog.showModalDialog(options);
        } function DialogCallback(dialogResult, returnValue){}

        and I get this error when try to hit Register

        Webpage error details
        User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)
        Timestamp: Tue, 13 May 2014 10:14:32 UTC
        Message: Script error
        Line: 0
        Char: 0
        Code: 0
        URI: https://cdn.jsdelivr.net/jquery/2.1.0/jquery.min.js
        Message: ‘SP.UI.ModalDialog’ is null or not an object
        Line: 642
        Char: 1
        Code: 0
        URI: https://my.abc.com/sites/RBCCI/Pages/Registracka.aspx

        1. I think now all is perfect except some bug in my code, and I cannot somehow move forward. It is interesting that the code work when Im in edit more of that particular page. But when I publish it it stop working.

          1. It seems that the javascript function hasn’t been loaded properly. Can you tell what happens when you run the link function in the javascript console of your browser?

          2. Press F12 on the key board and you will see the developer tool window. Find the scripts tab on the window from where you can see the script files loaded. Select the required file and place a break point, To debug refresh the page or perform the required actions
            My suggestion would be, that before doing that all, please make sure all the relavent files are published.

          1. I think I have not done any enabling …..publishing feature, do I need to download the java file from web and place it somewhere in Site collection library? Im using SP2013

          2. The function call SP.UI.ModalDialog.showModalDialog(options); shows the register window. According to your error message, the Javascript Object SP.UI.ModalDialog does not exit. This is very odd. However I’m not sure why I haven’t experienced this problem. I just want to make sure now that you have the same SharePoint features enabled as I have. I believe that the the Javascript Object is part of the publishing feature. Please check wether you have this site/farm feature enabled.

          3. I do have the Sharepoint Server Publishing enabled. I cannot find/do not have the Publishing Infrastructure in the list

          4. According to this website post: http://www.enjoysharepoint.com/Articles/Details/sp-ui-modaldialog-showmodaldialog-do-not-work-20572.aspx?utm_content=buffer549c5&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer#.Uy56eWLKDZg.twitter. Your error is quite common. Replace your javascript with:

            // visit http://www.jsdelivr.com/#!jquery to update the cdn url

            function OpenRegistrationForm(meeting_id){

            var options = {

            // to geht following make a right click on the new item link in the Class Attendees list and select open in new tab.

            // Now copy the url in the browser from the beginning to the of the &RootFolder= part

            // Inser the link below and replace [RootFolder] with meeting_id

            url:”http://sharepoint.vbl.ch/Personal/Lists/Class%20Attendees/Item/newifs.aspx?List=21803ee2-66ab-4df2-9116-b02853ca7e1a&meeting_id=” + meeting_id,

            width: 750,

            height: 600,

            dialogReturnValueCallback: DialogCallback

            };

            SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);

            }

            function DialogCallback(dialogResult, returnValue){}

          5. function OpenRegistrationForm(meeting_id){
            var options = {
            url:”https://my.abc.com/sites/RBCCI/Lists/Attendees/Item/newifs.aspx?List=6614640d%2Dca81%2D4bbe%2D99b3%2D1762d52676bf&meeting_id=” +meeting_id,
            width: 750,
            height: 600,
            dialogReturnValueCallback: DialogCallback
            };
            SP.UI.ModalDialog.showModalDialog(options);
            } function DialogCallback(dialogResult, returnValue){}

          6. PERFECT now 100% work. I changed my original code to SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);

            Seems all is working good. Just the REMAINING SEATS does not count down, but I must have missed something somewhere so will go through the process again step by step. THANK YOU many times!!!!!!!!!!!!!!!!!!!!!

          7. No problem. It’s always nice to hear wether the things I’m writing about are usable or not. Let me know if I’ve got a mistake in the instructions.

          8. Janik, thank you. Your instructions were excellent! And this example is brilliant and useful to me. I went through the Registration Workflow again step by step as it does not reduce me the number of registrants when I register users it always remains the same number. In Atendee list I can see all the ones that are registered, but somehow does not reduce the REMAINING SEATS. πŸ™

          9. I found the issue. In the workflow i have to use “MeetingID” not “Meeting”. working!!!!!! Juuhuuuu.THANK YOU.

          10. Great! Nice to hear that. So is there a mistake in my instructions? Do I have to adjust something?

          11. Yes, in your original Registration Workflow — Step 16 and 21 you have “Meeting” and have to changed this to “MeetingID”

          12. Janik, also one question. I saw this solution somewhere. What should I do to have the page refresh automaticaly when user register. Now I need to press F5 to refres the page so the number shows -1. Is there any code I need to add to the page please? Thank you for your time in helping me!

          13. I’m not aware of way to accomplish that. Maybe it’s possible with a bunch javascript. However the workflow needs several seconds to update the remaining seats, it’s very difficult to tell the browser when he has to refresh the page. This is a very basic issue. In my experience this isn’t even a real problem, the chance of user registering for the same event at the same time is almost 0.

            Could you solve the remaining seats problem?

          14. Yes I solved everything and it works 100%, now just finetuning further details and tailor. THANK YOU!

          15. For the automatic refresh I add code — dialogReturnValueCallback: RefreshOnDialogClose — but still does not refresh πŸ™

          16. When I click on the Register button when Im in page edit mode the link works and opens the registration form. When I do it in the page standard mode, it gets the error

    2. Janik, I am having a similar issue except that when creating and customizing the Register Column on my Calendar list, it does not accept the formula. Please advise. Thanks

      1. Curtis, which issue are talking about? Is there a error message? Have you checked the formula’s syntax?

        1. When entering the formula for the Register Column it does not save. Just states there is an error with the formula but I input it exactly as shown referencing my own fields.

        2. Janik, when attempting to Register, the link does not work. It is clickable but opens nothing. On the actual event, I only see the “Concatenated fields” but not a register link. Please advise thanks

  2. Hello Janik, how difficult is to get “un-register” workflow up and running or “waiting list” πŸ™‚

  3. Hello Sir…I’ve been following your instructions and it seems pretty straight forward. I’m not an expert by far in Sharepoint…but I believe I have a problem with the Registration workflow. Not sure how to isolate the problem so I can fix it…Any suggestions would be helpful..

  4. This is the exact same instructions that Greg Galipeau posted 2 years ago. I am using it for my registration site. Someone mentioned the refresh issue and I’m not sure if they fixed it. To get around this I added a workflow that kicks off an email to the person that registered. In the same workflow I added a second email that gets sent if 0 seats are remaining apologizing that the class is now full. I also created a waitlist that opens once the class is full.

    This is an excellent tutorial to get started. Now if I could only figure out how to add a cancel registration function. πŸ™‚

    1. Hello Rachel,
      How did you get the Register open the InfoPath Form. Is there any specific name that should be used to save it ?
      Clicking the Register somehow does not bring up the InfoPath. Need help pl

  5. I’m stuck at the InfoPath part.
    How do you get the Title field to show up in the form? I only see username, attachment, meeting, and meetingid.
    Also when I try to paste the code from above into the textbox preferences for the fields I can see I get:
    ‘username’ is not a valid XSLT or XPath function.

    –>username()<–

    1. Can you tell me on which part of my guide you stuck. Sorry long time a go I wrote this. Usually the title field is always part of a new list, it should be available in your field selection.

      1. The Create InfoPath Form part. When I created the class list.. it only said to create 3 columns so thats all i created Ill go back and create another column for title as test then.

        The next part that is messing up is when i try and copy and paste the code from the site here into the FX fields. I get the error from above. Should I be doing it different instead of coping and pasting the code in?

        1. can you use the fx button and then the selection buttons. As far I remember info path sometimes doesn’t allow you simply to paste formulas in the formula box.

    1. Well, can’t really help you with that. I’m studying right now, so no more access to SharePoint πŸ™‚ Sorry for that. Not shure about an approach to solve this. For shure we would need a nother row containg the dekrement of the seats, if a user is deregister from a course, it should run a workflow that sets the seat count from that dekrement value.

      1. I see thank you. I tried using delete but delete do not trigger any workflow. I will think about the way a little bit more. I struggle now with IE11 and the InfoPath form itself not showing SAVE button πŸ™

  6. Any idea why the InfoPath form cannot show immediately SAVE button in IE version 11? I need to double click anywhere to working properly. This works fine in older IE version. Thank you.

  7. I followed everything just fine but when I use your formula in the Register field =IF(Closed=TRUE,”Closed for registration”,IF(RemainingSeats>0,CONCATENATE(“Register“),”Class is Full”)) get an error that the formula contains a syntax error or is not supported. I’ve tried it with semi-colons and with commas. Can you help? I can really use this solution.

    1. I also had some issues when inserting formulas. I suggest to insert the fields with the formula editor instead of copy and paste them, It seems that SP assoicate the fields in a different way with the formula when using the editor. Not shure about this…

  8. Looks like my paste didn’t put in the whole formula this is what I used: =IF(Closed=TRUE,”Closed for registration”,IF(RemainingSeats>0,CONCATENATE(“Register“),”Class is Full”))

      1. I was having the same issue, but in the end following worked for me:

        =IF(Closed=TRUE,”Closed”,IF(ReaminingSeats>0,CONCATENATE(“Register “,”Class is Open”)))

  9. Everything working, except I am not showing clickable
    link.
    I am showing “Register” and not the
    actually register clickable link.
    I have checked my syntaxon the Register field itself in the Calendar List and in the jQuery
    script. The script is added to a content editor web part on the Calendarlist page and the site showing the Calendar list.

  10. Everything is working, except I am not showing clickable link.
    I am showing “Register” and not the
    actual clickable link.
    I have checked my syntaxon the Register field itself in the Calendar List and in the jQuery
    script. The script is added to a content editor web part on the Calendarlist page and the site showing the Calendar list.

  11. I found the issue with the link not being clickable. This was due to Register not being set to return a number. I have fixed this and now have a clickable like. When I click nothing occurs, no error, not anything. MY java code looks good. I think my issue is where or how I am adding to the page. I am somewhat unclear on the step “adding javascript” right before “putting it together”. I have added the script to a text file that has been placed in the sites assets and al calling that file in a content editor web part placed below the webpart showing the class list. I am using the content link to link to the text file containing the java script. Is this right??

  12. I’m having a problem with not being able to publish the workflows. Error is ‘transition section cannot be empty. Insert a go-to action.
    Now my image looks different when I create the action. Instead of Step 1, it’s Stage 1.

    1. I figured it out. in 2013 I needed to insert an action in the transition to stage area, click the ‘stage’ hyperlink and select End of Workflow

  13. Running SharePoint 2010 as of right now, currently having the issue where the Meeting field will not populate. I’ve adjusted the workflow from the original MeetingId to Meeting in hopes of correcting the issue as a previous user experienced however that hadn’t worked. I believe either that or it may be improperly using the Query Filter as the JavaScript populates the New Item form as expected.

  14. Having issue where javascript dialog box is blank if logged into our SharePoint site remotely. The dialog box opens the new form fine if onsite.

    1. This solution is probably deprecated. I haven’t used the latest SharePoint version, so I’m not sure wether it is possible to achieve this without using InfoPath.

  15. When I click on the register link and attendees form loads up, on the courses lookup field I get undefined any clue?

  16. If I have fixed date and time slots for an event which has different locations can I have a signup sheet like this one in SharePoint? Thanks

  17. I have followed the tutorial. The register link is not clickable although the return type is a number. what is the code to include in the same page as register calendar view

  18. I love this. Not quite working yet but I bet it will. Do you know if there is a way to view available classes in the Calendar view before registering for that class?

Leave a Reply