aneguitar
Posts: 0
Joined: Tue Apr 16, 2013 6:51 am

Dynamically create multiple kind of options from a Rest Api

First of all I have a Rest API that the response variables (I grab it as json) are of course in an array. This means that the following resonse might have multiple data. The variables are:

option_id, (there might be multiple options)
type, (the type might be radio, checkbox, drop_down, field)
is_require
sort_order,
is_dependent,
title,
field_price
choices[ (These are the choices of the specific option, for example the checkboxes, etc)
option_type_id
title
sort_order
is_preselected
in_group_id
dependent_ids
]

As I am not very experienced in javascript I am not sure I can accomplish this.
I have seen the documentation
http://docs.tiggzi.com/tutorials/buil...
but I don't think that this covers my case.

Could you please give me an example code?
Thank you!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Dynamically create multiple kind of options from a Rest Api

Hello! From code you've posted it's difficult to understand program logic. You would need to run JS code on service success event to process the received data. All received data will be in value "data". If we understand you correctly you are going to add some elements on page. This should help http://api.jquery.com/category/manipu... - add data on page; http://api.jquerymobile.com/category/... - create elements

aneguitar
Posts: 0
Joined: Tue Apr 16, 2013 6:51 am

Dynamically create multiple kind of options from a Rest Api

Thank you for the answer.
Well what I want to do, is to create different kinds of options.
For example, radio buttons, then another option might be checkbox etc, based on the "type" of each "option_id" that is returned from the rest api as response.
What I am not sure I can do, is to create and show the different kind of options in the tiggzi app.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Dynamically create multiple kind of options from a Rest Api

What I am not sure I can do, is to create and show the different kind of options in the tiggzi app-- you can add anything you want. The links I posted above should help. Here is for example http://api.jquerymobile.com/checkboxr... - radio buttons и checkbox.

aneguitar
Posts: 0
Joined: Tue Apr 16, 2013 6:51 am

Dynamically create multiple kind of options from a Rest Api

I will check them out and let you know! Thank you

Return to “Issues”