Symantec IGA

Expand all | Collapse all

Populate a dropdown list with Java

Jump to Best Answer
  • 1.  Populate a dropdown list with Java

    Posted 11-07-2016 04:31 PM

    I have been attempting to dynamically populate a dropdown list based on other fields on the Create User page in CA Identity Manager. I have code that will check the other field's value but I can't properly set the dropdown values, all the values I insert are shown on one line instead of separate rows as shown below...

    I am wondering what the proper way to construct a dropdown list is, my code currently looks like this...

    user.addValueToAttribute("manager", "test1");

    user.addValueToAttribute("manager", "test2");

    I have tried many different ways to separate these entries into rows with no success, any input would be helpful.



  • 2.  Re: Populate a dropdown list with Java

    Posted 11-10-2016 05:14 AM

    Anyone?



  • 3.  Re: Populate a dropdown list with Java
    Best Answer

    Posted 11-10-2016 10:40 AM

    Well I figured out a solution...it's not the best option in the world, but it works. I ended up having to use a combination of java and javascript.

    My java code determines what values (pipe delimited) to insert into the dropdown box:

    At this point all three test values are still on one line, this is where javascript comes in handy. I set the "Source of selection options" to Javascript and use the getOptions() function...

    By taking the fieldContext value and then returning it back to the dropdown everything is formatted correctly and appears on separate rows in the dropdown.  



  • 4.  Re: Populate a dropdown list with Java

    Posted 06-04-2018 01:29 PM

    Thanks for posting the fix. I found myself in the exact same spot and this worked for me too.

     

    One follow-up: do you know if it's possible to mark one of the options as the "selected" one in the dropdown box?