locked
Several fields in same place of the CRM Form RRS feed

  • Question

  • Good day to All

    Suppose I have a picklist on CRM form. And I have an attribute corresponding to every picklist entry. I want a way to show different fields in the same place of the form, depending on the value that is selected in picklist. Now I just placed all fields in form, an disable and enable them using JavaScript in onChange event of picklist. It would be nice if all fields where in the same place, and then I, again using JS,  will show or hide them on onChange event. Can I do such kind of thing?

    Any help will be highly appreciated

    Regards

    Gagik Kyurkchyan

    Wednesday, May 18, 2011 7:45 AM

Answers

  • Good day to All

    Suppose I have a picklist on CRM form. And I have an attribute corresponding to every picklist entry. I want a way to show different fields in the same place of the form, depending on the value that is selected in picklist. Now I just placed all fields in form, an disable and enable them using JavaScript in onChange event of picklist. It would be nice if all fields where in the same place, and then I, again using JS,  will show or hide them on onChange event. Can I do such kind of thing?

    Any help will be highly appreciated

    Regards

    Gagik Kyurkchyan


    You can, as Andriy points out, hide and show labels and fields with Javascript. But having them all show up in the same place is actually quite a challenge, as the fields does not have any exposed position properties you could play with. You could probably accomplish this with (a lot) of Javascript injection, but that would require a lot of effort, testing, and would probably be unsupported.

    If you really need this then create a Silverlight web resource and embed it in an iframe on the form - that would be supported and a lot easier to accomplish

    Wednesday, May 18, 2011 8:32 AM
  • How about putting a blank field next to the picklisk, populating this and then having either a workflow or jscript populat the real fields, based on this value. This way you have one field next to the picklist and the picklist corresponding fields can be off the form completely, in the case of a workflow or hidden away on a tab in the case of jscript.

    Leon Tribe

    Want to hear me talk about all things CRM? Check out my blog

    http://leontribe.blogspot.com/

    or hear me tweet http://www.twitter.com/leontribe


    Want to hear me talk about all things CRM? Check out my blog http://leontribe.blogspot.com/ or hear me tweet @leontribe
    Thursday, May 19, 2011 6:00 AM

All replies

  • Hello Gagik,

    To hide field with label you can use following code (for CRM 4.0):

    crmForm.all.<field name>_c.style.display = "none";

    crmForm.all.<field name>_d.style.display = "none";

    To show it you can use following code:

    crmForm.all.<field name>_c.style.display = "";

    crmForm.all.<field name>_d.style.display = "";

    For CRM 2011 you should check following article about it - http://technet.microsoft.com/en-us/library/gg334266.aspx#BKMK_setVisible


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, May 18, 2011 7:57 AM
    Moderator
  • Hi Andriy

    Thanks for fast replay

    The problem is not in how to hide and show fields, but how to place them in the same place, and than only hide and show them depending on picklist value.

    Wednesday, May 18, 2011 8:22 AM
  • You can try tricks with DOM, but I'm not so good at it.
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, May 18, 2011 8:25 AM
    Moderator
  • Ok I'll explore that thanks! 
    Wednesday, May 18, 2011 8:27 AM
  • Good day to All

    Suppose I have a picklist on CRM form. And I have an attribute corresponding to every picklist entry. I want a way to show different fields in the same place of the form, depending on the value that is selected in picklist. Now I just placed all fields in form, an disable and enable them using JavaScript in onChange event of picklist. It would be nice if all fields where in the same place, and then I, again using JS,  will show or hide them on onChange event. Can I do such kind of thing?

    Any help will be highly appreciated

    Regards

    Gagik Kyurkchyan


    You can, as Andriy points out, hide and show labels and fields with Javascript. But having them all show up in the same place is actually quite a challenge, as the fields does not have any exposed position properties you could play with. You could probably accomplish this with (a lot) of Javascript injection, but that would require a lot of effort, testing, and would probably be unsupported.

    If you really need this then create a Silverlight web resource and embed it in an iframe on the form - that would be supported and a lot easier to accomplish

    Wednesday, May 18, 2011 8:32 AM
  • Gagik,

    I have an idea how to do it quickly.

    You should do following:

    1. Create Separated section on form and put all the fields (you wanted to place at the same place) in one column.

    2. Develop script which will hide/show those fields depends on picklist value.

    This would make possible to do it in easy way.


    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Wednesday, May 18, 2011 8:35 AM
    Moderator
  • Andriy

    That was the way I've actually solved the problem, till I would find a way to place them in the same place, but IMHO it looks some kind of odd from the point of view of User  (the fields will some kind of jump from one place to another when user selects a value from picklist). 

    Torstein Utne

    Nice idea about making a Silverlight page, I'll think about it, it's definitely easier than digging JS :)

     

    Wednesday, May 18, 2011 8:44 AM
  • How about putting a blank field next to the picklisk, populating this and then having either a workflow or jscript populat the real fields, based on this value. This way you have one field next to the picklist and the picklist corresponding fields can be off the form completely, in the case of a workflow or hidden away on a tab in the case of jscript.

    Leon Tribe

    Want to hear me talk about all things CRM? Check out my blog

    http://leontribe.blogspot.com/

    or hear me tweet http://www.twitter.com/leontribe


    Want to hear me talk about all things CRM? Check out my blog http://leontribe.blogspot.com/ or hear me tweet @leontribe
    Thursday, May 19, 2011 6:00 AM
  • Hi Leon

    Thanks for the answer! Nice idea.

     

    Gagik Kyurkchyan

    Thursday, May 19, 2011 6:50 AM