Webform: Display filtered child table according to parent


I have these fields in doctype Ingredients:

  • stock_type of type Data (Vegetables, Fruit, etc.)
  • stock_item of type Child Table, which in it has:
    item_name (Data)
    item_qty (Data)

So the data in this Ingredients doctype would be like:

  • Vegetables (this field in the doctype, as the parent field)
    – Carrot (these items are in a child table)
    – Celery
    – etc
  • Fruit:
    – Apple
    – Orange
    – etc

Then I make a webform Recipe based on the doctype above and set 2 fields:

  • select_stock as Link to the Ingredient doctype (which will show list of stock_type)
  • select_item (I don’t know what field type to define yet, but it is not a table)

How do I filtered populate the select_item based on selection of select_stock?
So if I chose Vegetables in the select_stock, the select_item will display Carrot, Celery to choose from.

Please note that select_item in the webform is not a table, so in the webform I can only choose 1 stock_type and 1 related stock_item.

Thank you.

Does anyone have any suggestion about this?
Or is there any way to do it differently?

We would need really appreciate anyone support on this

Maybe to rephrase this question:

Display stock_item where stock_type is Vegetables

But the stock_item is child table of stock_type in Ingredients form.

Welcome sir