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

Home » RADICORE development » Application Development » Choose null on add3 popup (Query on code)
Choose null on add3 popup [message #4044] Wed, 15 January 2014 12:53 Go to next message
David Lee is currently offline  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 #4045 is a reply to message #4044] Wed, 15 January 2014 17:58 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
In the _cm_popupCall() method of the task which calls the popup you must set $settings['select_one'] to FALSE. This will allow multiple selections in the popup screen and will remove the 'Choose Null' button.

Re: Choose null on add3 popup [message #4047 is a reply to message #4045] Sat, 18 January 2014 05:36 Go to previous messageGo to next message
David Lee is currently offline  David Lee
Messages: 44
Registered: June 2006
Member
Thanks for the guidance. I have also noted since I posted that http://www.tonymarston.net/php-mysql/dialog-types.html#popup details that choose null and cancel are not the same, and shows a screen from the framework with a choose null option - /dict/table(popup2).php, from relationship(add2)a.php, which I did not find previously as I was only looking at ones from add3 screens.
Re: Choose null on add3 popup [message #4048 is a reply to message #4047] Sat, 18 January 2014 06:15 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
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.


Re: Choose null on add3 popup [message #4586 is a reply to message #4048] Wed, 01 October 2014 03:04 Go to previous message
Rumor1928 is currently offline  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.
Previous Topic: New window for graphics
Next Topic: Compound foreign keys in linking tables
Goto Forum:
  


Current Time: Fri Mar 29 02:28:12 EDT 2024

Total time taken to generate the page: 0.03316 seconds