Dynamic Selection Lists not working with my server event

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
elazarus3
User
Posts: 90

Dynamic Selection Lists not working with my server event

Post by elazarus3 »

I downloaded the demo. All works fine, except with all my fields that are dynamic dropdowns, selection lists, or radio buttons. No values display in my forms for any of these fields, in any tables.

Example, field ov_location
Radio button
Check Use Lookup Table
Check Required
-rest unchecked

In lookup
Table Name: locations
link field: name
Display field #1: name

Order by: name
ASC/DESC ASC

rest blank

Any ideas?


elazarus3
User
Posts: 90

Post by elazarus3 »

I was able to find the line of code that is causing this behavior.

In Page_loading event, I have this line of code:

if (!isset($SESSION['redirect_login'])) $SESSION['redirect_login'] =
ew_ExecuteScalar("SELECT value FROM global_text_variables WHERE name = 'redirectlogin'");

If I remove this line, and just assign this session variable, then all my dynamic selection lists function just fine.


arbei
User
Posts: 9292

Post by arbei »

Your code causes error (and hence the JSON result for selection lists become invalid) because the ew_ExecuteScalar() uses the global connection object $GLOBALS["conn"], but in some pages, e.g. ewmodallookup.php and ewlookup.php, the object $GLOBALS["conn"] is not available.

You can check if the connection is available first.

For example:
if ($GLOBALS["conn"]) {
// your code
}

Alternatively, you can specify a database explicitly:

For example: ew_ExecuteScalar("...", "DB"); // Note: "DB" is the DB ID of the main database.


Post Reply