Hide objects from selected users depends on the login info entered

Meshal Alawwad shared this question 1 year ago
Answered

Hello,


So I am getting a little deeper in Justinmind, I have 5 users, each will see different objects (Texts, button, etc) within any page, and I would like to make this by creating a login validation, for example I will have to type 'admin' in the username field and click 'login' to view what can the admin see, the same goes for the other type of users.


I saw the Data driven web prototype and variables but it didn't help me very much.


Thanks a lot

Comments (4)

photo
1

Hi there,


First create a variable that will represent the selected user. Then create an 'on click -> set value' event for the login validation button, and have it set the value of the variable as the value of the selected user. Then, on the other page, create an 'on page load' event with hide/show events for all elements you would like to be hidden/shown depending on the user selected. Lastly, create a condition for each of these hide/show events that is" When... [variable] = 'user'" - creating this condition for each different possible user type.


Let me know if you have any questions.


Best,

Danielle

photo
1

It didn't work, please correct me if I am wrong.

"Then, on the other page, create an 'on page load' event with hide/show events for all elements you would like to be hidden/shown depending on the user selected."

The page I opened has elements I would like to hide, I right click on the element, clicks 'Add event', choose 'On page load' and 'Hide'.

"Lastly, create a condition for each of these hide/show events that is" When... [variable] = 'user'" - creating this condition for each different possible user type."

From the Events tab, right click on the hide event, click 'Add action after selected', choose 'On Variable Change', choose the variable which is the selected user, and finally choose 'Hide'

This is what I did, and it didn't work.

photo
1

I don't think you want the additional "on variable change" event. You want a condition expression on each hide/show event that checks the user id variable to determine that the hide/show event is appropriate for that user. E.g. Condition Expression: "When user_id = 1" on Hide Event: "On Page Load > Hide > text_box_a", when hiding text_box_a is an appropriate event for user with id of 1.

photo
photo
1

Thank you so much for help guys! It's working now :)