locked
Multi select Pick list RRS feed

Answers

  • Hi Vishawz!

    I have used the following Javascript function and it works for me(Using CRM 4.0). The basic approach is to store the selected picklist values on to ntext attribute. Copy this function on the Onchange Event of the picklist attribute. Pass the parameters required.


    function MultiSelectPicklist_OnChange (picklistField, valuesField, separator)
    {
        var selectedValue = picklistField.SelectedText;
        var values = valuesField.DataValue;
        if (values == null) values = '';
     
        // Skip if the selected value is the empty default
        if (selectedValue.length > 0) {
     
            // Unless the selected value already appears in the list...
            if (values.indexOf(selectedValue) < 0) {
                // Add it, including a separator if it's not the first value.
                if (values.length > 0) values += separator;
                values += selectedValue;
                valuesField.DataValue = values;
                valuesField.SetFocus();
                }
            }
    }

    Hope this helps!!

    Thanks,
    Shonai
    Thursday, August 28, 2008 12:31 PM

All replies

  • Hi Vishawz!

    I have used the following Javascript function and it works for me(Using CRM 4.0). The basic approach is to store the selected picklist values on to ntext attribute. Copy this function on the Onchange Event of the picklist attribute. Pass the parameters required.


    function MultiSelectPicklist_OnChange (picklistField, valuesField, separator)
    {
        var selectedValue = picklistField.SelectedText;
        var values = valuesField.DataValue;
        if (values == null) values = '';
     
        // Skip if the selected value is the empty default
        if (selectedValue.length > 0) {
     
            // Unless the selected value already appears in the list...
            if (values.indexOf(selectedValue) < 0) {
                // Add it, including a separator if it's not the first value.
                if (values.length > 0) values += separator;
                values += selectedValue;
                valuesField.DataValue = values;
                valuesField.SetFocus();
                }
            }
    }

    Hope this helps!!

    Thanks,
    Shonai
    Thursday, August 28, 2008 12:31 PM
  • This will probably let you to add picklist value to the ntext attribute but will not allow you to remove selected item. 

     

    I have a "messy" multi-picklist solution and also a multi-lookup solution (make all relationship to become multi-select).  Let me know if you are interested or not. 

    Thursday, August 28, 2008 2:37 PM
  • Lee,

    It would allow you to remove the selected item from the ntext attribute. If that is what you were refering to. Anyways, I am curious to know your solutions for Multi Select and Multi lookup custom solutions.

    Thanks,
    Shonai
    Friday, August 29, 2008 8:53 AM
  • Thanks Shonai,

     

    Ur code really helped me , It is working fine

     

    Last wekk i had faced few problems on Multi Lookup

     

    I would like  know your solutions for Multi Select and Multi lookup custom solutions.

     

    Once again Thanks a lot Shonai and Lee

     


     

    Friday, August 29, 2008 9:28 AM
  • No problem.  I will post it on my blog (which I am working on, ) and post it ASAP.

     

    Jude

     

    Friday, August 29, 2008 7:36 PM
  • hey thanx for the solution. But i want to know the parameters to be passed to the function.

     

    u hav written the function as

    MultiSelectPicklist_OnChange (picklistField, valuesField, separator)
    {

    }

     

    will the call be like this?

     

    MultiSelectPicklist_OnChange (picklistField(name of the picklist) , valuesField(name of the text field here ntext) , separator (the seperator to be shown in text field) )

    {

    }

     

     

    plz guide me as i am stuck over here from qrite some time.

     

    Thanx and regards,

     

    CoderAmul

    Wednesday, September 24, 2008 11:00 AM
  • Amul,

     

    The parameters to be passed are :

    1.  name of the picklist field

    2.  name of the ntext field

    3. delimiter/separator (like : or ; etc)

     

     

    Thanks,

    Shonai

    Friday, September 26, 2008 11:36 AM