Page 1 of 1

Lookup Field

Posted: 2022-08-03 14:32
by angus
Hi everyone, I updated the Advanced option in the lookup field so that I only select records after a certain date. This all works ok.

The issue I have though is that the search box no longer works - only happened after I updated the Advanced box.

When I restore the default the search box works again.

I am using 5.82.

does anyone know this issue and how to fix it?

Re: Lookup Field

Posted: 2022-08-03 14:42
by jsetzer
Maybe an error in your customized SQL command. Can you post it here?

Re: Lookup Field

Posted: 2022-08-03 20:45
by angus
thanks Jan, the code is from the ajax_combo.php (I entered this in the Advanced field in the appgini tool)

Code: Select all

'member' => array(
				'parent_table' => 'old_member',
				'parent_pk_field' => 'wbsid',
				'parent_caption' => '`old_member`.`member`',
				'parent_from' => '`old_member` ',
				'filterers' => array(),
/*				'custom_query' => '',*/
				'custom_query' => 'SELECT `old_member`.`wbsid`, `old_member`.`member` 
								   FROM `old_member` 
								   where str_to_date(monthValidTo, \'%d/%m/%Y\') > CURDATE()
								   ORDER BY 2',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true

Re: Lookup Field

Posted: 2022-08-03 21:19
by jsetzer
Maybe I did not understand. I understood lookup does NOT work when you disable default query in advanced lookup settings and enter a custom sql query. The custom query should be a SQL command, not a php array as given in your last post.

Re: Lookup Field

Posted: 2022-08-04 00:06
by angus
I input into the advanced field on the Lookup Field tab. This then outputs the code above into the ajax_combo.php field I think Jan
appgini_lookup_field2.png
appgini_lookup_field2.png (88.16 KiB) Viewed 3891 times
The image is where I enter the query. I did a test and removed it, and search worked OK, when I added the query again, the search does not work

Re: Lookup Field

Posted: 2022-08-04 04:27
by jsetzer
For narrowing down, take that SQL command and run it in your SQL tool (for example adminer or phpMyAdmin). See if it works at all.

Re: Lookup Field

Posted: 2022-08-04 09:30
by angus
Yes, works perfect

Re: Lookup Field

Posted: 2022-08-04 11:36
by jsetzer
Next step could be watching the network traffic between browser and server in browser's development tooks when fetching records on opening dropdown. What is the server response?

Re: Lookup Field

Posted: 2022-08-05 14:20
by angus
sorry Jan, not sure how I do this?

Re: Lookup Field

Posted: 2022-08-05 14:27
by jsetzer
- F12
- Open network tab
- Click lookup arrow button and watch out for the ajax_combo.php call, listed in network tab
(You can even filter on ajax_combo)
- select the entry and check payload and response

There may be an error or there may be an empty result. Can you post some relevant screenshots of the network tab and also check if there are errors in console tab.

Re: Lookup Field

Posted: 2022-08-07 16:40
by angus
Jan, had a go at this but could not see any lookup arrow button
screenshot_appgini.png
screenshot_appgini.png (71.44 KiB) Viewed 3742 times

Re: Lookup Field

Posted: 2022-08-07 17:19
by jsetzer
but could not see any lookup arrow button
Sorry, I meant the button in DV which opens the select list of the lookup field you are referring to.

In other words: open the lookup by clicking it. This should force the client to request available lookup-entries from the server. You will see the network request on click immediately. When selecting that request in network tab, you can see the payload (data sent to server by client) and response (data the client received from server).

Screenshots of request and respond would help if there is a problem.