Page 1 of 1

Auto complete with json display bug

Posted: Fri Feb 26, 2016 4:01 am
by kyosuke
Hello,

i create a universal display file to do a web service in JSON and use the autocomplete choice URL
so i follow this example http://www.profoundlogic.com/docs/display/PUI/Textbox
but i use RPGLE progamme to valuate PNAME and PRID
universal.JPG
universal.JPG (67.27 KiB) Viewed 719 times
rpgle.JPG
rpgle.JPG (33.04 KiB) Viewed 719 times
i also valuate the query parameter for create JSON with the paramete enter in textbox
and i map the URL /TST_JSON to my programe in PUIMAPP

so in my screen on the textbox i add in choice url my link
url.JPG
url.JPG (55.24 KiB) Viewed 719 times

Re: Auto complete with json display bug

Posted: Fri Feb 26, 2016 4:09 am
by kyosuke
so i make some test and its seems to work well
baignoire.JPG
baignoire.JPG (293.73 KiB) Viewed 717 times
but when i write "vasque double" the programe send me the good json but the auto complete div is not open and when i foce the div with display: block
it dosent display the good result it show me the last result
vasque.JPG
vasque.JPG (300.22 KiB) Viewed 717 times
so the JSON is good just the data in div is not good and its make it for some word but not all just a few.

Re: Auto complete with json display bug

Posted: Fri Feb 26, 2016 8:43 pm
by Scott Klement
Your Universal record for "content" looks wrong to me.

The problem that I see is that there is a comma at the end of your data. This is a problem because it is not legal in JSON to have a comma at the end of the data unless there is another element that follows it. So the following would be valid:

Code: Select all

[
  { data },
  { data },
  { data }
]
But the following would not be valid (and this is what yours would look like)

Code: Select all

[
  { data },
  { data },
  { data },      <-- extra comma at the end makes it NOT valid
]
The Universal display file has a feature to solve this problem automatically. Please remove the trailing comma from your "content" record. Without the comma it should look like this:

Code: Select all

{
   "PNAME": "[nom]",
   "PRID": "[num]"
}   < -- NO COMMA HERE
then change the "separator" property for the record format to contain a comma. the Universal display handler will automatically put a seperator between elements (but not after the last one).
comma.png
comma.png (10.12 KiB) Viewed 706 times
Let me know if that helps

Re: Auto complete with json display bug

Posted: Mon Feb 29, 2016 3:48 pm
by kyosuke
I can't test it this week , but I will keep you informed

Re: Auto complete with json display bug

Posted: Mon Mar 07, 2016 9:51 am
by kyosuke
Hello,

I tried your solution and it still not work but i see a little difference, when JSON work he appear like that
fonctione.JPG
fonctione.JPG (138.37 KiB) Viewed 682 times


and when the he dont, like that
fonctione_pas.JPG
fonctione_pas.JPG (140 KiB) Viewed 682 times
Any idea?

Re: Auto complete with json display bug

Posted: Mon Mar 07, 2016 12:52 pm
by Scott Klement
There is an error in your JSON somewhere. You will need to discover where it is and fix it.

Re: Auto complete with json display bug

Posted: Tue Mar 08, 2016 3:28 am
by kyosuke
Hello,

Inded i tested my json in validator and i find error with a quote in a label

thank you for your time.