Page 1 of 1

Variable create_service with Checkbox

Posted: Wed Jan 08, 2014 4:06 pm
by Joao Marcos Barbosa Oliveira

I have a Checkbox item that are loading data from my DataBase. It has a variable number of items. I want to do a create_service with this item. For each item that is selected in this Checkbox I have to insert value in my another collection. How I do that?


Variable create_service with Checkbox

Posted: Wed Jan 08, 2014 5:47 pm
by Maryna Brodina

Hello! You would need to retrieve all checked values using JS and invoke Create service for them.


Variable create_service with Checkbox

Posted: Wed Jan 08, 2014 6:23 pm
by Joao Marcos Barbosa Oliveira

When I use the create_service all the items, including the not selected, are inserted in one record into the Database. I want that just the selected items are include into the Database in separate inserts.


Variable create_service with Checkbox

Posted: Wed Jan 08, 2014 8:08 pm
by Joao Marcos Barbosa Oliveira

How can I do that? Have some step by step tutorial?


Variable create_service with Checkbox

Posted: Wed Jan 08, 2014 9:30 pm
by Maryna Brodina

Using JS you have to select all checked checkboxes in a group and for each one invoke Create service passing values as parameters. This should help http://docs.appery.io/documentation/r... (see Invoking a service from JavaScript section). For example preAppery("checkboxgroupName").find("input:checked").each(function(){
createServiceName.execute({"data": {"paramName": $(this).val()});
})/pre