Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » How do I use a GLOBALS or _SESSION field selection
How do I use a GLOBALS or _SESSION field selection [message #659] Fri, 23 February 2007 15:42 Go to next message
danpoleary is currently offline  danpoleary
Messages: 49
Registered: February 2007
Member
I am trying to validate the role of the user against a column in my table from the tasks "Selection (fixed)" field. Is this possible, or am I bound to static strings?

Thanks,

Dan
Re: How do I use a GLOBALS or _SESSION field selection [message #660 is a reply to message #659] Fri, 23 February 2007 16:45 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
The "selection (fixed)" and "selection (temporary)" fields can only contain static strings. If you want to use the contents of any session or global variable you must do so in your code.

Re: How do I use a GLOBALS or _SESSION field selection [message #663 is a reply to message #660] Fri, 02 March 2007 10:24 Go to previous messageGo to next message
danpoleary is currently offline  danpoleary
Messages: 49
Registered: February 2007
Member
Thanks,

Now for the second problem, I edited the generated (list1).php for my app, and inserted the following

$sql_where = "source_key=$_SESSION['role_id']";

I also tried setting a local variable like:

$the_role = $_SESSION['role_id'];
$sql_where = "source_key='$the_role'";

The "source_key" is a column in my table used for both external references and enforcement of role access to specific rows. In both cases the role_id is blank. Is it not available inside the generated tasks?

Any help would be appreciated

Dan O'Leary
Re: How do I use a GLOBALS or _SESSION field selection [message #664 is a reply to message #663] Fri, 02 March 2007 10:50 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
There is no value in $_SESSION['role_id'] until AFTER the session_start() function has been issued, which is done within the initSession() function. This in turn is called within each of the page controllers, so no session variables can be accessed within a component script. You will have to use one of the custom methods within your database table class, such as _cm_pre_getData().

Re: How do I use a GLOBALS or _SESSION field selection [message #665 is a reply to message #664] Fri, 02 March 2007 11:39 Go to previous message
danpoleary is currently offline  danpoleary
Messages: 49
Registered: February 2007
Member
Thank you Tony,

With what you told me, and what I saw in a previous post, I was able to get my role_id to work correctly.

Again, thanks for all the help!

Dan O'Leary
Previous Topic: Setting up of a subsystem to another Server
Next Topic: Custom Validation Executed - Blank Screen Displays
Goto Forum:
  


Current Time: Sun Nov 03 04:58:44 EST 2024

Total time taken to generate the page: 0.01066 seconds