locked
Hidden field visible in CRM 2011 based on Check box selection RRS feed

  • Question

  • Hi All,

    My requirement is :

    #Part 1) Initially when the form load's  Picklist field is hidden

    part 2)When check box is checked picklist box should be visible .

    I have  written a code also for the same  , Part 1 is working fine but part 2 is  not working .Please suggest some solution

     function Picklist_hidden()
    {


    if(crmForm.all.an_Checkboxname.DataValue  ==  false )


    {

    crmForm.all.an_Picklistname.style.visibility = 'hidden';

    }

    else

    {
    crmForm.all.an_Picklistname.style.visibility = 'visible';

    }

    }

     

    Is is there any error in my code ?

    Appreciate your help

    Cheers,

    S

     


    Tuesday, April 26, 2011 11:48 AM

Answers

  • This should do it!

     

    if

     

    (Xrm.Page.getAttribute("an_Checkboxname").getValue() == false

    )

     

    {

    Xrm.Page.getControl(

    "an_Picklistname").setVisible(false

    );

    }

    else

    {

    Xrm.Page.getControl(

    "an_Picklistname").setVisible(true

    );

    }

    }

     

    • Proposed as answer by Michael Karls Tuesday, April 26, 2011 9:34 PM
    • Marked as answer by SSQLL Wednesday, April 27, 2011 9:04 AM
    Tuesday, April 26, 2011 9:34 PM

All replies

  • This should do it!

     

    if

     

    (Xrm.Page.getAttribute("an_Checkboxname").getValue() == false

    )

     

    {

    Xrm.Page.getControl(

    "an_Picklistname").setVisible(false

    );

    }

    else

    {

    Xrm.Page.getControl(

    "an_Picklistname").setVisible(true

    );

    }

    }

     

    • Proposed as answer by Michael Karls Tuesday, April 26, 2011 9:34 PM
    • Marked as answer by SSQLL Wednesday, April 27, 2011 9:04 AM
    Tuesday, April 26, 2011 9:34 PM
  • HI Michael,

     

    Thanks for your reply . it worked fine .

    My 2 cents , in addition to this we need to declare globally ,ie  when form Onloads .

     

    Cheers,

    S

     

    Wednesday, April 27, 2011 9:04 AM
  • This code looks great, and it works for me as well. The only issue is the White Space when the field is hidden. How can we collapse those fields and collapse the whitespace as well?
    Thursday, February 2, 2012 12:50 AM
  • If you hide sections instead of fields they rollup.
    Tuesday, October 8, 2013 1:15 AM
  • Try this:

    if (Xrm.Page.getAttribute("checkBoxField").getValue()) 

    {

    Xrm.Page.getControl("optionSetField").setVisible(true);

    }

    else

    {

    Xrm.Page.getControl("optionSetField").setVisible(false);

    }

    Regards,

    Rameshwari

    Tuesday, October 8, 2013 6:39 AM
  • With Dynamics CRM 2015 it works by using Business rules:

    http://www.dynamicscrmpros.com/hiding-section-fields-microsoft-dynamics-crm-2013-using-business-rules/


    Powered by http://www.AZUREBLOG.eu

    Thursday, April 23, 2015 9:41 AM