Option Depnds on Previous Field alue

Hello All,
How can I Display Option of Select Type Which Depends On Previous Field Value?
in the Previous Field Value If I Select Manufacturing Then the Option Of Next Field Will display Based On It if I select Service Then the Option of the Next Field Will Display Based On Service. Is It Possible Through Custom Script ??

yes,you can use filters in custom script to achieve this …

Thank you for Response
okay can You Give me an Example if Possible

frappe.ui.form.on(‘Doctype’, {

    cur_frm.fields_dict['fieldname(basedonfield)'].get_query = function(doc, dt, dn) {
    return {
    filters:{"fieldname(previousfield)": "condition"}

you can refer to this block of code and arrange this according to your field names and values.

what will be the condition ??

condition is your previous field value e.g. if you select Manufacturing in previous field then Manufacturing is your condition value…

Thank You,
How can i do this in my Web form also ?