Choose null on add3 popup [message #4044] |
Wed, 15 January 2014 12:53 |
David Lee
Messages: 44 Registered: June 2006
|
Member |
|
|
Please could you confirm if the select null option is correctly handled in add3. I found that on return from the popup, $selection is "table_index=''". It appears to me that if, on the initialisation in std.add3.inc, the code is
$where = $dbobject->initialise($where, $selection);
then the message 'Nothing selected from popup screen' appears, which I would regard as correct behaviour. However, the actual code is
$null = null;
$where = $dbobject->initialise($where, $null);
which causes further code to be executed instead of returning quickly, and, for me then produced an sql error, possibly because of some other bug in my code.
Checking to see how other add3 screens in the system work, I could not find any which did not have the "choose null" button suppressed, but the cancel button servers the same purpose. It may be that the quickest work round for me is to suppress that button in my application, but I thought I would raise it here first for advice.
|
|
|
|
|
Re: Choose null on add3 popup [message #4048 is a reply to message #4047] |
Sat, 18 January 2014 06:15 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
When a popup is called from an ADD3 screen you are supposed to set $settings['select_one']=FALSE so that the popup screen will allow you to make multiple selections. This is done by displaying the SELECT boxes as checkboxes. In this case the popup will remove the 'Choose Null' button. The ADD3 screen is used to maintain the contents of the link table in a many-to-many relationship, and it will take whatever is selected in the popup and add it to the link table. You either CHOOSE records in the popup or you CANCEL. Using CHOOSE NULL will attempt to add a record with a NULL value, which produces the error you encountered.
When a popup is called from other screens then the default value of $settings['select_one'] is TRUE, in which case the popup screen will show the SELECT boxes as radio buttons causing only a single selection to be possible. In these screens the popup is used to a supply a single value for a single field in the current database record, and this value may be set to an actual value or emptied with a NULL value.
I hope this makes it clear.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: Choose null on add3 popup [message #4586 is a reply to message #4048] |
Wed, 01 October 2014 03:04 |
Rumor1928
Messages: 1 Registered: October 2014 Location: Belarus
|
Junior Member |
|
|
AJM wrote on Sat, 18 January 2014 11:15
When a popup is called from other screens then the default value of $settings['select_one'] is TRUE, in which case the popup screen will show the SELECT boxes as radio buttons causing only a single selection to be possible. In these screens the popup is used to a supply a single value for a single field in the current database record, and this value may be set to an actual value or emptied with a NULL value.
This is a very good and clear explanation AJM. I also faced the misunderstanding of null and cancel records, but I figured it out.
Work for Intellectsoft.net, USA office.
|
|
|