Forum Academy Marketplace Showcase Pricing Features

Checkbox custom event trigger

Hello, Need help regarding manually trigger checkbox (check or uncheck)inside the Repeating group.
Anybody assist me…

Hi @testingwebdev2016 :slight_smile: You can use the workflow event “When an input’s value is changed” Element: (Checkbox within the RG) --> Trigger Custom Event.

@fayewatson
I have problem inside the repeating group checkbox, when i manually select the checkbox, it will trigger the checkbox changed event in the workflow, but when i setting checkbox preset status “Checked” then it not trigger the changed workflow.
For your reference,

Ohh I see. To confirm, do you need an event to run on RG cells where the checkbox is changed to checked, or preset to checked on page load? Can you share a link to the editor?

@fayewatson, “preset to checked on page load to trigger change event”:
Can you see the sample link


From above, if i changing the dropdown category automatically checkbox will select, but insertion to the “Productcategory” is not done.
If i click on checkbox on product list, it works.

Since you’re trying to assign a Category to a Product, I think it would be best to use Auto-binding. This will automatically save the Category to the Product’s Category field, and also not cost any workflows.

Preview:

Editor:

To set this up, I create a new field on the Product data type called “Category” (Type: Category, List: No).

Then I placed the Category dropdown within the repeating group and enabled auto-binding:

I also added an alert which shows when the the auto-bind is successful:

In order for auto-binding to work, there needs to be a data privacy role which defines which Users are able to complete this action. You can restrict this to only Users who are the Creator of a Product can use auto-binding, but in this example I set it to everyone by default:

The last step was just to add an Input and a Create button in order for Users to create a new Category.

Let me know if this solution works for your purposes or if you have any questions. :slight_smile:

Thanks for the reponse.
this was manually selecting the category for each product.
But my question is which selecting the single category i will affect the all the product which are not associated with category.
Example If selecting the “Category A” will it associate with all products.

No problem at all! On this page, the User checks products, and then selects a category from the dropdown (then clicks ‘Save’) to associate the Dropdown’s Category with each checked Product. Is this what you were looking to set up?

If you choosing the category it will stored into product table. but what i need is storing the category and product details another table called “Productcategory” table
so one product will associated with many category and stored into another table (Productcategory).
Have any solution?

Ohh I see, here is the updated example which automatically creates a new ProductCategory when the checkbox is checked (and has the option to delete the ProductCategory):

Is there any possible to add all the products and selected category on Product category?


Like above image?

If is selecting the category A then i will associate all the products, and stored into productcategory table.

The User would select a Category and a new ProductCategory would be created for all products in the repeating group (without using the checkbox)?

Yes, checkbox is optional to assign category to an product.
But default if i selecting the category need to add product and selected category to productcategory table.

This might not be the only way, but I think you would need to Schedule an API workflow on a list (the repeating group of products) in order to create a new ProductCategory Thing for each item in the repeating group - connected to the dropdown’s category. (If you’re not using the checkbox method where that is created as the User checks the box).

Ok, other than the checkbox. Only apply the selected category to all the product? Can you have sample workflow or something.
Please help me out to fix this.

To set up API endpoints and schedule API workflows on a list the account needs to be on the Personal Plan or higher. I’m sorry I’m unable to set up an example with screenshots right now (but if you search the forum for Schedule an API workflow on a list there are some examples about doing this to a create multiple Things).

Yes i understand, but i dont know how to work with API workflow. do you have any sample screenshot?

Sorry for the delay - here is a step-by-step :slight_smile:

To set up the API endpoint, first go to the Settings tab and click “This App exposes a POST/Workflow API”

Then click in the pages/resuable elements panel, and “API workflows will appear at the bottom”:

Click on this and then click to create a new API endpoint.

In this example, I named the endpoint “New ProductCategory”, and then clicked “+ Add a new parameter”, twice, in order to setup the two Keys that we need: the “Product” key and “Category” key. I used basic names, but you can name the Key anything you want (for example, if you ever have a workflow which uses two different Products, each would have a different name to remind you of what their purpose is for in the workflow’s actions). We need to create these parameters because each ProductCategory will be created, and then contain two fields: a Product field and a Category field (before moving onto the next Product item in the list).

After setting up the endpoint, I added the Data --> Create a New Thing action. This tells Bubble that when this endpoint is run, to create a new Thing each time (a new ProductCategory entry). The ProductCategory Thing will be composed of the Product and Category which we defined in the endpoint using “Product” and “Category”, and this will repeat for all Products in the repeating group.

Once that is all set, navigate back to your page containing the repeating group of Products and Category dropdown.

In the workflow tab, create a new custom event which Schedules the API workflow on the repeating group list of Products:

Here we’re stating that the API workflow should run on the list of repeating group Products, and the API workflow is the “new productcategory” which was the name I chose for the API endpoint. “This Product” represents the current workflow’s Product, which will continuously change as the API goes down the list of Products. Products within the repeating group change, and the Dropdown Category’s value remains the same each time a new Thing is created.

The last step is just to schedule the custom event when the ‘Save’ button is clicked:

And once that’s set up, it should create a new ProductCategory thing as the API workflow moves down the repeating group’s list of products one-by-one. If any of this was confusing or if you get stuck setting this up in your app please feel free to let me know. :slight_smile:

1 Like

Thank you so much. this is awesome. let me try and get back to you :slight_smile:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.