Required fields are a big part of developing powerful and effective forms in Profile. At first glance of the richness of forms you would think it was easy to mark a field as a required field to save the form. This feature is missing completely and left up to writing the behaviour manually inside the save macro event. Although it's not overly difficult to write the code there is quite the detail to get it correct and some forms have some dependent or hierarchical conditions.
Required fields at its simplest is to have a mandatory field be checked or filled in with a value in order to save the form. To perform this action in macro is to check if the fields control has a value and if not cancel the save action with a warning message beside the control that has failed the mandatory check.
'not successful validation
Profile.Variable("CanSave").Value = False
Profile.Variable("ShowMessage").Value = True
'check of both radio buttons are not checked
if Controls_("rbAbuseInLast12Months").Checked = false and Controls_("rbAbuseInLast12Months2").Checked = false then
Profile.Variable("ControlName").Value = "lblAbuseInLast12Months"
Profile.Variable("ErrorMessage").Value = "Must be specified"
Profile.Variable("ShowMessage").Value = False
Profile.Variable("CanSave").Value = True
So imagine a form with 100 fields and the majority have mandatory conditions, this will be quite the bit of code to write and mostly tedious.
At the most simplest usage of a required field, Intrahealth could implement this feature fairly easily. But the dependent or hierarchical nature of forms would quickly make this much more difficult to solve without coding.
However, in the latest version of Profile (8.4.x) they have taken a step towards solving the more complicated scenarios at least in the GUI part of the form. There are 2 new properties to take notice of; ControlsToEnable, ControlsToEnableReverse
Here is an example inside a form. If the user checks N/A then all the other options should disable, if the user checks the option other then the other textbox becomes available.
Normally this would all happen in macro code on each of the checked events of the controls where code would make that happen.
So we set the ControlsToEnable property of the N/A checkbox to the 4 other checkboxes. We also set the property ControlsToEnableReverse to true because in this scenario we want the other 4 controls to disable when checked. The default is enable when checked so the logic for this first part is reversed.
And the Other checkbox ControlsToEnable property to edOther (the name of the edit control) we effectively create a 2 tier logic without a line of code. We leave the ControlsToEnableReverse as false because we want the default behaviour of enabling the textbox when the Other checkbox is checked.
|First time viewing form
||N/A checked disables all other controls
||Checking Other enables the editbox for editing.
As there are multiple scenarios of logic this 2 new properties can do quite a bit and without the need for many lines of code that is more prone to human error.
However this is all done in the GUI only and as of yet I see now way for this logic to affect the forms save event for required fields.
This is a very nice and welcome addition to form design and we hope to see more.
When it comes to design or building a website there are many technical aspects to be covered.
I put together a presentation that points out some of the points to discuss when taking on the endeavor of web development.
- Domain Name
- Hosting provider
- Site Design
- Server OS
- Web Server Software
- Administration and Upkeep
- How to promote it?
View the presentation for each point in more detail.
Web Design Part 1.pptx (82.88 kb)
Please feel free to reach out to us for any discussions or even better if you would like to work with us. :)