Fast Uncompromising Discussions. FUDforum will get your users talking.
Problem in implementing this: 81. How can I enter a value before calling a POPUP form? I have a problem when I tried to enter textual value instead of foreign ID before calling a POPUP form. tkm_ep_fizicko_lice is a PERSON PARENT table in my application. 010 // ************************************************************ ********************* 020 function _cm_popupcall ($popupname, $where, $fieldarray, &$settings) 030 // perform custom processing after a call to ...... 040 { 050 if ($popupname == 'tkm_ep_fizicko_lice(popup1)') { 060 // clear out contents of %where 070 $where = ''; 080 // alow only one entry to be selected (the default) 090 $settings['select_one'] = true; 100 110 $where_uslov = '%'.$fieldarray['fiz_lice_id'].'%'; 120 $where = "ime_prezime LIKE '{$where_uslov}'"; 130 } // if 140 return $where; 150} // _cm_popupcall 160// ************************************************************ ********************* When I submit (add1) screen on CHILD table, where my popup form is, I had error text: 'Value is not whole number' Sys error (29), and I could not INSERT row in CHILD table Than I change this end solved problem: 1. In function _cm_getForeignData ($rowdata) I remember current ID from foreign PARENT table: $rowdata['fiz_lice_id_before'] = $foreign_data[0]['fiz_lice_id']; 2. In function _cm_pre_InsertRecord($rowdata) and in function _cm_pre_updateRecord ($rowdata) I put back contents of foreign ID field : $rowdata['fiz_lice_id'] = $rowdata['fiz_lice_id_before']; But... I put inside of Popup screen of PARENT (PERSON) table two buttons in pre select area NEW and SEARCH. and one button in select area UPDATE. I have problem with SEARCH. When I press SEARCH I found in field ime_prezime predefined text LIKE '%%', then I press CLEAR and contents dismissed, but SEARCH criteria for this field does not work. Always return ALL rows. I tried everything to reset this field but I could not find solution. When I commented line 120 from previous source example this LIKE '%% string dismissed, but primary option of enter a value before calling a POPUP form don't work. thanks
I do not understand your problem. It is possible to use code such as $where = "fieldname LIKE '%x%'"; in method _cm_popupcall() because I have tried it. Is the POPUP not being called with the correct search criteria? If the ADD1 task is failing after you have selected an entry from the POPUP form then what value did you select in the POPUP form? I do not understand your problem with the SEARCH screen. What do you mean by "two buttons in pre select area"?
I think I may have worked out what your problem actually is. If in the data dictionary you have set the value for foreign field to something different, then when the selection is returned from the POPUP it is converted into a different value. This in turn means that when you press the SUBMIT button the wrong value is posted back, which could explain your 'Value is not whole number' error. The fix for this is very simple, and I have updated FAQ81 accordingly. If this is the case then your description of the problem was woefully inadquate. You should have noticed that the key value was being replaced by a non-key value.