This topic is locked

Modify form based on login?

11/5/2008 12:53:31
PHPRunner General questions
E
ekurzen author

I need to create a database through which users log in and are presented with a form to fill out, with the values of the pulldown menus on the form to be customized for the user based on the login credentials, which reference a separate database. So, for example, User 1 logs in and sees a form with options A, B, C, and D; User 2 logs in and gets options B and D, user 3 gets options A, C, and D, etc. Is this possible to do in PHPRunner?
Thanks for your help.
Eric

Sergey Kornilov admin 11/5/2008

User Group Permissions come to mind. Using User Group Permissions you can restrict user access to certain actions or tables.

E
ekurzen author 11/5/2008

User Group Permissions come to mind. Using User Group Permissions you can restrict user access to certain actions or tables.


Thanks for the tip, Sergey. But I don't want to restrict access so much as present different options in various fields on the form, based on the user. Is that possible?

J
Jane 11/6/2008

Hi,
I recommend you to have a look at the User can see and edit their records only security method on the Advanced security settings dialog on the Security tab.

E
ekurzen author 11/6/2008

Hi,

I recommend you to have a look at the User can see and edit their records only security method on the Advanced security settings dialog on the Security tab.


Hi, Jane. I was planning on enabling that feature, since users will only be adding their own records, but I don't see where that could allow me to customize the form for specific users. Can you explain how this feature would help?

Sergey Kornilov admin 11/7/2008

ekurzen,
I guess you need to explain what are options A,B,C,D.
If they are different records in database table use Advanced Security.

If they are links to different tables use User group permissions.

E
ekurzen author 11/7/2008

ekurzen,

I guess you need to explain what are options A,B,C,D.
If they are different records in database table use Advanced Security.

If they are links to different tables use User group permissions.


I'm sorry, I'll be more specific. I'm creating this database to use for students registering for classes. The student logs in with his username and password, which is validated against another database. The student is directed to the Add Record page which autopopulates his personal information and presents him with a dropdown menu which contains a customized list of classes he can choose from. The values listed in that dropdown menu would be based on his login credentials.
So, options A, B, C, and D aren't different records or links to tables, they're just different values in a dropdown menu on the Add Record page.
This might be beyond the capabilities of the software, but I thought I'd ask; it'd be extremely helpful if I could get this to work.
Thanks for your help.
Cheers,
Eric

Sergey Kornilov admin 11/7/2008

Eric,
it all depends on how you want to display this custom menu.
Here is the idea:
Template

{BEGIN OptionA}<a href='pageA.php'>Option A</a><br>{END OptionA}

{BEGIN OptionB}<a href='pageB.php'>Option B</a><br>{END OptionB}

{BEGIN OptionC}<a href='pageC.php'>Option C</a><br>{END OptionC}


BeforeProcess event:

if ($SESSION["UserID"]=="UserA")

{

$xt->assign("OptionA",true);

$xt->assign("OptionB",true);

$xt->assign("OptionC",false);

}

else if ($SESSION["UserID"]=="UserB")

{

$xt->assign("OptionA",false);

$xt->assign("OptionB",true);

$xt->assign("OptionC",true);
}

else

{

$xt->assign("OptionA", false);

$xt->assign("OptionB", false);

$xt->assign("OptionC",false);

}
E
ekurzen author 11/11/2008

Great. Thank you, Sergey. I'll give that a try.
Cheers,
Eric