Today we’re starting a new series of blog posts where I look at some of the more advanced developer techniques that appear within the new templates available for Power Pages. Some of the techniques I may like, other I may have alternatives for, but I’m hoping that if you read this series it will show you the possibilities of what can be done with Power Pages if you’re willing to get your hands dirty with a bit of code.
Before we get into the technique itself, I wanted to mention that I consider the Power Pages templates to examples of what can be done with the product, but not necessarily a part of the product itself. What I mean by that is I don’t consider the templates to be meant as the definition of how things should be done. Think of each template as if they were built within their own separate project, with its own scope, budget and timeline, which were not infinite. We also don’t know the skillset of whoever built these templates – perhaps they were experienced Power Pages developers, or maybe this was their first time working with the platform. Just like any project I’ve ever worked on, the end result was not perfection. There are usually things that after everything is done that you’d like to make better.
It is easy to go into the project after the fact and say what could have been done better. But we don’t know how much time was allocated to the team who implemented these templates. So please understand that the purpose of this series isn’t to criticize what was done, but just to look at the techniques so that you can add to your repertoire.
The first technique we’ll look at appears in the After School template. This template is intended for after school programs where children can attend various type of courses after their regular school day. As a parent myself with two kids that attend both before and after school programs, I certainly understand the value of having a site that simplifies the registration process.
Specifically, the technique appears in the administrative side of things. Users with the C1 ASP Web Role have the ability the manage the courses that appear to parents for registration – this includes creating, editing, duplicating and deleting courses. This technique is used on the create, edit and duplicate course screens.
To be honest, this is not an approach I’ve used in the past, but mostly because it had never occurred to me to do that.
However, this technique does give you more control over the process, and by using the Web API, you can achieve things not possible with Forms out-of-the-box, such as saving an image as part of the create request (while Forms supports file and image columns, they are only for updates, not creates).
So perhaps there was a firm requirement that the image could be uploaded as part of the create. Or maybe the team just want to demonstrate a different way of doing it. Overall, I don’t mind the technique as long as there is a good reason for it.
Secondly, rather than creating custom validation, I’d lean toward trying to leverage the out-of-the-box validation, and if you needed to enhance it, add custom validator functions only when necessary.
Overall, a very interesting technique, something that I’m sure we’ll use at some point, and I definitely learned something by looking into it!