When using a field that is visible to only certain roles, when a user without the necessary role to see that field arrives on the page, your question field in this instance is not included on the page. And thus any default values tied to your fields that are shown to certain roles, don't get rendered if the required permissions doesn't exist for that user.
So as a viable workaround you can use question events to hide or show your field.
Create a hidden field on the form that will use the $(UserID) token to find the necessary role of the current user viewing the page. You will use the SQL default value feature for this hidden field, and this hidden field must have the smallest sort order (being the first field on the form). Make sure your question field is set to be hidden until forced visible by Question Event.
So here's what you're hidden field SQL default would look like if you only wanted to show the checkbox to Administrators:
-------------------------------------------------------------------------------
DECLARE @userID int
SET @userID = (SELECT COUNT(A.RoleName) FROM Roles A INNER JOIN UserRoles B ON A.RoleID = B.RoleID INNER JOIN Users C ON B.UserID = C.UserID WHERE C.UserID = '$(UserID)' AND A.RoleName = 'Administrators')
IF @userID > 0
BEGIN
SELECT 'True' AS DefaultValue
END
ELSE
BEGIN
SELECT 'False' AS DefaultValue
END
-------------------------------------------------------------------------------
Now you will create a Question Event that will fire based on your hidden field value 'True'. Then you will show/display your question field when hidden field value = 'True'.
Now you have accomplished a similar but more efficient way to hide/ show a field based on a required roles from a user.
If any questions arise please email us at dnnsupport@datasprings.com with the Subject Line:
"Blog Post: Hide/Show Question Field"
Thanks,
Ryan