Firing hidden fields On Change RRS feed

  • Question

  • Hi

    I'm looking for a good guide that will start me down the track of hiding fields on forms and then having them fire based on the picklist value of another field.

    I am a novice at this so 'idiots guides' are applicable.

    Thanks in advance


    Wednesday, August 18, 2010 9:01 AM


All replies

  • Hi Dave,

    Do you want to execute it on client side?

    If yest then through javascript make the visiblity as false by getting an element through document.getelementbyid().


    Wednesday, August 18, 2010 9:09 AM
  • you can write simple JS script onchange of your picklist as below, remember you also have write this code on form onload

    like for example you want to hide another field name "newField" when anybody will select first option from picklist so here will be the code for that






    Let us know if you need any other information

    Mahain : http://mahenderpal.wordpress.com
    Wednesday, August 18, 2010 9:11 AM
  • If initially you want to hide the field & then based on picklist value want to make them visible then :

    OnLoad event of Form :



    & to make it visible again add follwing code in OnChange of picklist attribute :




    Thank You.


    • Proposed as answer by JayshriP Wednesday, August 18, 2010 9:23 AM
    Wednesday, August 18, 2010 9:20 AM
  • Hi Dave,

    Please see the below link which has lot of examples like hiding fields [and other javascript examples: playing with MS CRM forms / attributes]:


    Hoep this helps

    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    • Proposed as answer by Ranjitsingh R Wednesday, August 18, 2010 12:27 PM
    • Marked as answer by Dave0109 Saturday, August 21, 2010 10:25 AM
    Wednesday, August 18, 2010 12:27 PM
  • Hi Jayshir

    What does the _c & _d do? Is one the field and one the field name?

    Appreciate your help.


    Saturday, August 21, 2010 10:27 AM
  • In forms, crm attributes don't have property that allows hiding them...

    So the only way to hide a field is to find the label '_c', the control '_d' and hide them

    My blog : http://mscrmtools.blogspot.com

    All my tools on my new dedicated site: MSCRMTools Repository
    Saturday, August 21, 2010 10:49 AM
  • Hi Jayshir

    What does the _c & _d do? Is one the field and one the field name?

    Appreciate your help.


    "crmForm.all.fieldName_c " refers to field label on the form & "crmform.all.fieldName_d" refers to the actual control for field/attribute on the form.

    Thank you.


    Monday, August 23, 2010 4:32 AM
  • Right, thanks for all the advice.

    I've added the following code:

    if(crmForm.all.sec1_loggingsolution.DataValue == 7)
             crmForm.all.sec-1_loggingother_c.style.display = 'inline';
             crmForm.all.sec-1_loggingother_d.style.display = 'inline';
             crmForm.all.sec-1_loggingother_c.style.display = 'none';
             crmForm.all.sec-1_loggingother_d.style.display = 'none';

    This seems to work fine based on the pick list trigger however the sec1_loggingother field only appears "on save", is this right or can it be instant?

    Monday, August 23, 2010 12:23 PM
  • "OnLoad" if crmFormType="UPDATE" then also you can check for picklist datavalue & then hide/show "sec1_loggingother " field accordingly. In case of new record i.e. OnLoad if crmFormType="CREATE" then sec1_loggingsolution.DataValue  might be null & "sec1_loggingother" will not appear on form (because as per your code it will satisfy ELSE part)  .

    Thank you.



    Tuesday, August 24, 2010 5:12 AM