Edit View > Text Field > Lookup not working

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
jkrainak
User
Posts: 12

Edit View > Text Field > Lookup not working

Post by jkrainak »

Hi there. I have Use Lookup Table checked and the Lookup itself setup:

Field name StaffID
Lookup table is viewTeachers
Link field is ID
Display fields are Last_name and First_Name

The lookup works as expected when the Edit Tag is a Select/Drop Down menu. When changing the Edit Tag to Text for this field I can type in the field, but no Lookup takes place

Thanks for listening


jkrainak
User
Posts: 12

Post by jkrainak »

Update

The Text field Lookup works when I only have Last_Name selected as the Display Field #1. Does not work if

Display Field #1 Last_Name
Display Field #2 First_Name


MichaelG
User
Posts: 1171

Post by MichaelG »

Try enabling Tools -> Advanced Settings -> Auto-Suggest all display fields.


jkrainak
User
Posts: 12

Post by jkrainak »

Thanks for your reply - unfortunately that didn't do the trick.


MichaelG
User
Posts: 1171

Post by MichaelG »

Enable debug mode (Tools -> Advanced Settings -> Debug) and press F12 -> Network to check the network response for the lookup. See if it gives you any hint.


jkrainak
User
Posts: 12

Post by jkrainak »

So I see lots of successful 200 codes that the form is doing the Lookup, but no returned data in the JSON:

https://www.#######.net/########/api/lookup?q=ste&n=10&rnd=121010&start=-1

Request:

name "x_StaffID"
page "DisciplineAdd"
field "StaffID"
language "en-US"
ajax "autosuggest"

Response is empty

{}

I have another one working fine on that page named Violations, but it displays only one field (Not Lastname, Firstname like above)

Request after type "Re"

name "x_Violation"
page "DisciplineAdd"
field "Violation"
language "en-US"
ajax "autosuggest"

Response:

result "OK"
records [ {…}, {…}, {…} ]
totalRecordCount 3
version "24.7.4"
sql "SELECT [ID] AS [lf], [Violation] AS [df], '' AS [df2], '' AS [df3], '' AS [df4] FROM dbo.Discipline_Violations WHERE [Violation] LIKE 'Re%' /BeginOrderBy/ORDER BY [Violation]/EndOrderBy/"

Thanks for the suggestion.


Webmaster
User
Posts: 9438

Post by Webmaster »

sql "SELECT [ID] AS [lf], [Violation] AS [df], '' AS [df2], '' AS [df3], '' AS [df4] FROM dbo.Discipline_Violations WHERE [Violation] LIKE 'Re%' /BeginOrderBy/ORDER BY [Violation]/EndOrderBy/"

The SQL shows that you have not enabled Auto-Suggest all display fields yet. Please enable and regenerate all files and try again. Also make sure that you are using the latest version (ASP.NET Maker 2024.7).


jkrainak
User
Posts: 12

Post by jkrainak »

Thanks for your message. The SQL in the response you copied is from a working Select named Violation, and yes 24.7.4

There is no SQL in the Discipline SQL as the response is just {}


MichaelG
User
Posts: 1171

Post by MichaelG »

Have you set up the option correctly as per previous reply?

The SQL shows that you have not enabled Auto-Suggest all display fields yet. Please enable and regenerate all files and try again.

If you are a registered user, you may consider sending your project file to the support email for quicker resolution.


jkrainak
User
Posts: 12

Post by jkrainak »

Sorry, I missed that suggestion . I just now enabled Advanced > Auto-Suggest All Fields but still no go on the StaffID input type TEXT Lookup for both LAST_NAME and FIRST_NAME after regenerating all files. I've also tried different browsers, incognito tab, etc.

I did notice that when the ADD page loads there is a "lookup" request made even though I haven't typed anything yet. From F12 Developer Tools:

URL

https://www.#####.net/discipline2024/api/lookup

POST

[{"page":"DisciplineAdd","field":"StaffID","ajax":"updateoption","language":"en-US","name":"x_StaffID","v0":114980},{"page":"DisciplineAdd","field":"Code","ajax":"updateoption","language":"en-US","name":"x_Code","v0":"1"},{"page":"DisciplineAdd","field":"Violation","ajax":"updateoption","language":"en-US","name":"x_Violation","v0":163625}]

Request Headers

POST /discipline2024/api/lookup HTTP/1.1
Host: www.#####.net
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:129.0) Gecko/20100101 Firefox/129.0
Accept: application/json, text/javascript, /; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Content-Type: application/json
X-Authorization: REMOVED
Csrf-Name: __RequestVerificationToken
Request-Verification-Token: REMOVED
X-Requested-With: XMLHttpRequest
Content-Length: 341
Origin: https://www.#####.net
Connection: keep-alive
Referer: https://www.######.net/discipline2024/D ... DCID=12894
Cookie: REMOVED
ASPSESSIONIDAGSTDDRQ=DJHDJHDDPMHELNALNPMHCAOF; ASPSESSIONIDCUTTSSDA=OFHLNBHCACGAEHJDLEJEMOCH
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin

Response Headers:

HTTP/1.1 200 OK
Cache-Control: private,max-age=0,no-store,no-cache,must-revalidate
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Expires: Sat, 31 Aug 2024 04:21:07 GMT
Last-Modified: Sat, 31 Aug 2024 04:21:07 GMT
ETag: "87F26B7243B6E509EDC8F97FFE072BD9"
Vary: Accept, Accept-Language, Accept-Encoding
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Sat, 31 Aug 2024 04:21:06 GMT

Response:

[{"result":"OK","records":[],"totalRecordCount":0,"version":"24.7.4"},{"result":"OK","records":[{"lf":1,"df":"-","df2":"","df3":"","df4":""}],"totalRecordCount":1,"version":"24.7.4"},{"result":"OK","records":[],"totalRecordCount":0,"version":"24.7.4"}]

Thanks again.


MichaelG
User
Posts: 1171

Post by MichaelG »

As explained, you also need:

Enable debug mode (Tools -> Advanced Settings -> Debug) and press F12 -> Network to check the network response for the lookup. See if it gives you any hint.

Check the network response for auto suggest (lookup), i.e., when you start typing in your text.


jkrainak
User
Posts: 12

Post by jkrainak »

Thanks, I did that - response is above. Maybe I'm not understanding your message.


MichaelG
User
Posts: 1171

Post by MichaelG »

There will be multiple lookup responses. Press F12 -> Network first. Load your page, click the Clear network log button, type the text to start the auto suggest, you should find the correct lookup response.


Post Reply