Dynamic Auto-Complete By JSON

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Dynamic Auto-Complete By JSON

Post by dieter »

Hello,
i want to create a webservice which gives data to a combo box. Is there an example which data format the webservice has to deliver? In the documentation i found an example like this:

Code: Select all

"The choices URL property allows you to use an external program to return your choice options and values by passing them using JSON formatting".
{
     "success":true,
     "response":[
          new Option("Dishes and Cups","18"),
          new Option("Soaps","14")
     ]
}
I am not a web specialist, but i think that this in no JSON format. It seems to be a mixture of JSON and Javascript. Is this format the only way to get choices and values via an url? (In this case i have to extend my JSON tools because they can only create pure JSON Objects).



P.S.
I just extended my JSON Tools, so now the tools can create this format. It works.
Dieter.



Dieter
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Dynamic Auto-Complete By JSON

Post by Scott Klement »

Yes, unfortunately they used JavaScript code for this instead of JSON.

Personally, I'd rather have plain JSON for the messages exchanged between the server and the browser, but unfortunately, in this case they didn't do that... they used some JavaScript code in the JSON.
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Re: Dynamic Auto-Complete By JSON

Post by dieter »

Thank you for your answer.
I agree with you. Yesterday i was happy because my RPG-tools could write pure JSON without failures. Today i had to change my tools to write "unpure" JSON.

But this is no problem, i could encapsulate the format inside my tools. First i thought that i had not understand the documentation. But your answer gave me the safety that i am right.

Thank you.

Another question. The format in the example is:

Code: Select all

{
     "success":true,
     "response":[
          new Option("Dishes and Cups","18"),
          new Option("Soaps","14")
     ]
}
Is "18" a string or is it a string representation of a number? Would the following be correct: (The numbers are not in quotation marks):

Code: Select all

{
     "success":true,
     "response":[
          new Option("salary",1234.56),
          new Option("tax",234.56)
     ]
}
Is a string the only datatype or are there another types like numbers, dates, booleans?

Dieter
aj_400
New User
Posts: 8
Joined: Mon Oct 25, 2010 9:52 am
First Name: Andreas
Last Name: Strietholt
Company Name: Task Force IT-Consulting GmbH
Phone: +49 2309 609301
Address 1: Im Eickel 77
City: Waltrop
Zip / Postal Code: 45731
Country: Germany
Contact:

Re: Dynamic Auto-Complete By JSON

Post by aj_400 »

Hi Dieter,

i have created this using the Universal DSPF and it works very fine.

You can see it, using this link (in Geman) : http://forum.taskforce-it.de/viewtopic.php?f=4&t=69

Regards
Andreas
dieter
Experienced User
Posts: 122
Joined: Tue May 22, 2012 6:45 am
First Name: Dieter
Last Name: Schröder
Company Name: Ecclesia Holding GmbH
State / Province: Outside Canada/USA
Country: Germany
Contact:

Re: Dynamic Auto-Complete By JSON

Post by dieter »

Thank you, Andreas.

Your example is very nice. My problem was the understanding of the format. In the documentation the format was called "JSON". But the format is not JSON, it is JavaScript.

Regards,
Dieter
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests