Dependent Field Options

andymcdonald
Kilo Guru

I am trying to limit the choice list options coming on the Change Request form, when using Mass update ci class option.  Proposed Change is dependent on CI class, so it merely offers all fields on the CI class.  The issue is that we want to limit the options for a couple of the fields, namely install_status and operational_status.  However, I have no direct access to these lists because of the way the form is setup.  Is there any way to limit the options available to the user here?  The problem is not that --None-- is shown, rather it is that the default choice list is being shown and I do not see any way to remove options from the list.

2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @andymcdonald,

You can check onLoad if both field combination match then remove all options and add the required one only.

 

you can use g_form.clearOptions('<FieldName>'); this will remove all choice option.

later use g_form.addOption('<FieldName>'), value ); to add required options.

 

-Thanks,

AshishKMishra 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

no sir, it is not so easy.  proposed_change is dependent on which type is selected in CI class list.  So for example, CI class is chosen as cmdb_ci_server, then proposed_change shows a list of every Server field.  Then, when user selects one of those fields, say install_status, then the next field, highlighted in screenshot, displays every install_status option that is valid for Server.  I am not seeing any access to this list (no access to it via g_form).