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

Home » RADICORE » How To » POPUPs do not display
POPUPs do not display [message #1030] Mon, 06 August 2007 14:01 Go to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
My database has independent tables GRANTS and STAFF and dependent table GRANT_STAFF. I have setup a task that lists (LIST1) staff working on a grant on the Radicore navigation bar and allows selection for editing the GRANT_STAFF record.

My problem: The grant and staff are stored as numeric codes and I want a popup for each. But the codes are NOT being converted (i.e.the number codes are being displayed). Can you give me any idea where to solve this problem?

1. I setup relations from GRANTS and STAFF to GRANT_STAFF.
2. In the GRANT_STAFF table, columns grant_pk and staff_pk (primary keys to the 2 tables) have Control = POPUP, Foreign Fields points to the text field I want to display in the GRANTS or STAFF table. Task ID points to "div_grantstaff_grant2(popup2)" and "div_grantstaff_staff2(popup2)".

Here is a little code from grant_staff.dict.inc
$fieldspec['grant_pk'] = array('type' => 'integer',
'size' => 5, 'minvalue' => 0, 'maxvalue' => 65535,
'pkey' => 'y', 'required' => 'y',
'control' => 'popup',
'task_id' => div_grantstaff_grant2(popup2)',
'foreign_field' => 'title_full');

$fieldspec['staff_pk'] = array('type' => 'integer',
'size' => 5, 'minvalue' => 0, 'maxvalue' => 65535,
'pkey' => 'y', 'required' => 'y',
'control' => 'popup',
'task_id' => 'div_grantstaff_staff2(popup2)',
'foreign_field' => 'lname');

// parent relationship details
$this->parent_relations[] = array('parent' => 'grants',
'parent_field' => 'grant_pk',
'fields' => array('grant_pk' => 'grant_pk'));

$this->parent_relations[] = array('parent' => 'staff',
'parent_field' => 'staff_pk',
'fields' => array('staff_pk' => 'staff_pk'));

Re: POPUPs do not display [message #1032 is a reply to message #1030] Mon, 06 August 2007 14:53 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
If you read http://www.tonymarston.net/php-mysql/infrastructure-faq.html you should see your mistake. In your relationship details you are setting 'parent_field' to the primary key field and not the description field which you wish to display instead of the primary key (either 'title_full' or 'lname' in your example). Because you haven't specified the right field names they are not being retrieved from the database, therefore cannot be displayed.

Re: POPUPs do not display [message #1034 is a reply to message #1030] Tue, 07 August 2007 07:37 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
Yes, it is as you point out, the parent_field must be correctly specified...I guess I though that the Relationship between the snr and jnr tables referred exclusively to the primary-foreign key relationship. I now understand that, in addition, this relationship points to a field, called the parent_field (single or calculated) that can be retrieved in a popup. I also now see that the "Foreign Field" entry on the Update Column screen must exactly match with this parent_field when the control type=POPUP. Obviously, this was not clear to me.

Finally, when I create a calculated field in the Relationship by setting Parent_field = CALCULATED and Calculated Field as
"CONCAT(fname, ' ',lname) AS fullname"
and I also set the "Foreign Field" on the Update Column screen to "fullname"

I see that Radicore adds slashes to the Calculated Filed...
CONCAT(fname, \' \', lname) AS fullname

In addition I get an error when calling the screen...

Fatal Error: MySQL error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\' \', lname) AS fullname FROM grant_staff LEFT JOIN grants ON (grants.grant_pk=' at line 1 (# 1064).

SQL query: SELECT SQL_CALC_FOUND_ROWS grant_staff.*, grants.grant_pk, CONCAT(fname, \' \', lname) AS fullname FROM grant_staff LEFT JOIN grants ON (grants.grant_pk=grant_staff.grant_pk) LEFT JOIN staff ON (staff.staff_pk=grant_staff.staff_pk) WHERE grant_staff.grant_pk='3' LIMIT 25 OFFSET 0

Error in line 404 of file 'C:\xampp\htdocs\radicore\includes\dml.mysqli.class.inc'.

Please advise. Sad

Re: POPUPs do not display [message #1035 is a reply to message #1034] Tue, 07 August 2007 08:32 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Quote:

I see that Radicore adds slashes to the Calculated Filed...
CONCAT(fname, \' \', lname) AS fullname

Not on my system it doesn't. If you load in the data for the XAMPLE subsystem you will the CONCAT() function in use on the relationship between X_PERSON and X_PERSON_ADDR, and it does not have any slashes - at least not on the screen. They are visible inside the x_person_addr.dict.inc file but that is only because the string is enclosed in single quotes.

I suggest you remove the backslashes from the relationship screen, re-export the dictionary data, then try running the code again.


Re: POPUPs do not display [message #1036 is a reply to message #1035] Tue, 07 August 2007 09:06 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
On the Update Relationship screen with snr=STAFF and jnr=GRANT_STAFF, I set Parent Field = CALCULATED and Calculated Field =
concat(fname, ' ', lname) as fullname

After clicking SUBMIT or SUBMIT+next the Calculated Field shows
concat(fname, \' \', lname) as fullname

My \radicore\htaccess.txt includes...
php_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value magic_quotes_sybase 0

After Export-to-PHP the grant_staff.dict.inc includes...
$this->parent_relations[] = array('parent' => 'staff',
'parent_field' => 'concat(fname, \\\' \\\', lname) as fullname',
'fields' => array('staff_pk' => 'staff_pk'));

If I manually edit the above reference (in grant_staff.dict.inc to
'parent_field' => 'concat(fname, \' \', lname) as fullname',
it works as intended.

[Updated on: Tue, 07 August 2007 09:24]

Report message to a moderator

Re: POPUPs do not display [message #1037 is a reply to message #1036] Tue, 07 August 2007 09:45 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
It sounds like you have magic quotes turned on in your php.ini file, and the directives in the htaccess file are not being actioned. Can you run phpinfo() and see what it says?

Re: POPUPs do not display [message #1038 is a reply to message #1030] Tue, 07 August 2007 09:59 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
Yes. My php.ini had
magic_quotes_gpc = On
now set to Off.
Everything working fine.
Thanks
Re: POPUPs do not display [message #1039 is a reply to message #1038] Tue, 07 August 2007 10:31 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
You need to find out why the instructions in the htaccess file are not being actioned. Have you configured Apache to process htaccess files? Full instructions are provided in the installation notes at http://www.radicore.org/installation.php

Re: POPUPs do not display [message #1040 is a reply to message #1030] Tue, 07 August 2007 10:43 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
My c:\xampp\htdocs\radicore\htaccess.txt file is copied below

<Files ~ "\.inc$">
Order deny,allow
Deny from all
</Files>

php_value default_charset "UTF-8"
php_value include_path " .;c:\xampp\HTDOCS\RADICORE\INCLUDES;c:\xampp\HTDOCS\INCLUDES "

php_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value magic_quotes_sybase 0
php_value session.use_cookies 1
php_value session.use_only_cookies 0
php_value session.use_trans_sid 1
php_value session.gc_maxlifetime 3600
php_value arg_separator.output "&amp;"
php_value url_rewriter.tags "a=href,area=href,frame=src,input=src,fieldset="

Re: POPUPs do not display [message #1041 is a reply to message #1040] Tue, 07 August 2007 11:02 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Yes, but have you configured Apache to process the htaccess file? If you have not then the contents are irrelevant as they will be ignored.

Re: POPUPs do not display [message #1042 is a reply to message #1030] Tue, 07 August 2007 11:17 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
My c:\xampp\apache\conf\httpd.conf file includes...

<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Re: POPUPs do not display [message #1043 is a reply to message #1042] Tue, 07 August 2007 11:35 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
You are still not following the instructions documented in http://www.radicore.org/installation.php

What do you have in the "AccessFileName" directive. By default the filename is (dot)htaccess, but as this name is not valid in Windows systems you must change it to htaccess.txt


Re: POPUPs do not display [message #1045 is a reply to message #1030] Tue, 07 August 2007 11:48 Go to previous messageGo to next message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
AccessFileName htaccess.txt
<Files ~ "^htaccess\.">
Order allow,deny
Deny from all
</Files>

Taken from c:\xampp\apache\conf\httpd.conf
Re: POPUPs do not display [message #1046 is a reply to message #1045] Tue, 07 August 2007 12:08 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
There must be something wrong somewhere otherwise the 'magic_quotes_gpc' directive in the htaccess file would have worked without you having to change your php.ini file.

Re: POPUPs do not display [message #1047 is a reply to message #1030] Tue, 07 August 2007 12:33 Go to previous message
adamsp is currently offline  adamsp
Messages: 32
Registered: July 2007
Member
I suppose so. Otherwise, I am not aware of any problems access Radicore files. So perhaps the problem is not critical.
Previous Topic: Generate PHP Issues
Next Topic: Adding new child record error: No Parent Selected Yet
Goto Forum:
  


Current Time: Fri Nov 08 22:36:10 EST 2024

Total time taken to generate the page: 0.01336 seconds