Can we change field labels based on value in another field?

I wanted to change field label of a field based on on the value chosen in another field.Is it possible ?

I know this is super late but if someone stumbles upon this in 2023, you can achieve this with client script.

Example based on Select option in Web Form:

frappe.web_form.on('nationality', function (field, value) {
    if (value == "Non-Malaysian")
        frappe.web_form.set_df_property('id_number', 'label', "Passport No")
    else if (value == "Malaysian")
        frappe.web_form.set_df_property('id_number', 'label', "MyKad No")
    else
        frappe.web_form.set_df_property('id_number', 'label', "ID Number")
});

I stumbled across this in 2023 while trying to learn more about this. Thanks for helping out those of us who search the forums!

1 Like