Tuesday, January 11, 2011

Hide a form field

Now that each field offers an OnChange event, we want to use it. At least I do. Based on the selection or values in another field, I'm disabling fields all over the screen. But why disabling and not hide them?! It's not documented and therefore not supported, but it sometimes is needed. The code to hide a field is:

crmForm.all.name_c.style.visibility = 'hidden';
crmForm.all.name_d.style.visibility = 'hidden';

1 comment:

  1. crmForm.all.your_field.style.display = "none";
    //hides the magnifier of the lookup fields or the input of the other types of fields
    crmForm.all.your_field_c.style.display = "none"; //hides the label
    crmForm.all.your_field_d.style.display = "none"; //hides the input of the
    lookup fields

    If you have more fields that you cannot delete and want to hide, put them
    all on a tab and use, for example:

    crmForm.all.tab4Tab.style.display = "none"; //hides the fifth tab on the
    form (index no. 4)

    ReplyDelete