LookupMulti count selected total

rss

Posted by djp81 - Jan 26 ’17 at 10:35

Hi,

I am using a LookupMulti field, called customers, the left column has the available customers populated from a list,

Is there a way to count the number of customers that have been selected and moved into the right hand column on submit? have tried a few ways with no luck

Thanks

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 26 days
    #1 by Dmitry Kozlov Jan 27 ’17 at 03:29

    Hi,

    The following code returns the number of selected items:

    fd.field('FieldName').control()._el().find('select:eq(1) option').length

    Replace 'FieldName' with the internal name of the lookup field.

  • djp81
    Member
    Member for: 2 years 6 months 21 days
    #2 by djp81 Jan 27 ’17 at 04:32

    Perfect smile

    Last question! how would you then search through the selected customers to find a specific one, e.g. if 3 were selected and i needed to know if "Microsoft" was one of the customers?

     

    Thank you

  • djp81
    Member
    Member for: 2 years 6 months 21 days
    #3 by djp81 Jan 27 ’17 at 05:21

    [#2]: ignore the above, i managed to get it to work smile

Displaying 1 to 3 of 3 messages