Cameron Posted January 6, 2016 Report Share Posted January 6, 2016 Hello everyone, Happy New Year I have a Gallery DataPage with Authentication. In the DataSource of the Authentication, there is the "Admin" checkbox. I want to display the value of a field only if a user is admin and display a message, if a user is not admin. I know, that it is a better to use two DataPages, but it is the only difference and I would like to use the same DataPage, if it's possible. Is it possible? Thank you for your time! Quote Link to comment Share on other sites More sharing options...
0 Xiang Posted January 6, 2016 Report Share Posted January 6, 2016 Hi Cameron, How are you? I think, you can add an HTML Block to the Result page, disable an HTML Editor and enter the code like follows: <script> var checkbox='[@authfield:admin]'; var hiddenValue="You cannot see this information"; if (checkbox=="Yes") hiddenValue = '[@field:HiddenValue]'; var line = "<span class='cbResultSetLabel'>Name </span><span class='cbResultSetData'>"+hiddenValue+"</span>"; document.write(line); </script> Enter the name of you field in the Authentication DataSource instead of admin in the line "var checkbox='[@authfield:admin]';". Enter your message instead of "You cannot see this information". Enter the name of the field that contains value instead of HiddenValue in the line "if (checkbox=="Yes") hiddenValue = '[@field:HiddenValue]';" But I'm not sure that it's a secure enough for you, JavaScript is not a secure instrument. Have a good day! Quote Link to comment Share on other sites More sharing options...
Question
Cameron
Hello everyone,
Happy New Year
I have a Gallery DataPage with Authentication. In the DataSource of the Authentication, there is the "Admin" checkbox.
I want to display the value of a field only if a user is admin and display a message, if a user is not admin.
I know, that it is a better to use two DataPages, but it is the only difference and I would like to use the same DataPage, if it's possible.
Is it possible?
Thank you for your time!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.