CA Service Management

Expand all | Collapse all

Make conditional read-only field

Jump to Best Answer
  • 1.  Make conditional read-only field

    Posted 03-09-2016 08:33 PM

    Hi Guys,

     

    Can anyone help me understand how I make one text field read only if another field on the same form has been populated.

     

    e.g.  Field A when populated with a value makes field B read only.



  • 2.  Re: Make conditional read-only field
    Best Answer

    Posted 03-10-2016 03:08 AM

    Hi,

    here is some examples based on algorithm:

    • attach event to object A;
    • switch readOnly state for object B;

    Re: Customizing dtlDate macro

    New field required if 'yes' is selected - Customizations / Modifications - ServiceDeskUsers

     

    Regards,

    Timur



  • 3.  Re: Make conditional read-only field

    Posted 03-16-2016 06:39 PM

    With the links help managed to get it to work....

     

    <PDM_IF "$args.z_final_ci" == "">

    <PDM_MACRO name=dtlLookup hdr="Configuration Item" attr=affected_resource evt="onChange=\\\"assetChanged()\\\" onFocus=\\\"assetChanged()\\\"" make_required=yes>

    <PDM_ELSE>

    <PDM_MACRO name=dtlReadonly hdr="Configuration Item" attr=affected_resource>

    </PDM_IF>



  • 4.  Re: Make conditional read-only field

    Broadcom Employee
    Posted 07-06-2017 08:22 AM

    Hi cdtj

     

    I am having a similar situation but here I want to make drop down and date field read only/editable on selection of particular status.

     

    I tried the solution from the links mentioned above by you which is working perfectly for text field but it is not working for date and drop down field.

    Is there any thing different that we need to do for drop down/date field?

     

    Thanks

    Tushar



  • 5.  Re: Make conditional read-only field

    Posted 07-10-2017 04:31 AM

    Hi,

    to make date field readonly you also need to disable click event/URL in field's header and write a method to make it clickable again. This can be done using JS/JQuery but I haven't any useful examples.

     

    For these purposes in our env we are simply switching mandatory state:

    detailMakeReq("sched_start_date", false); // to make "sched_start_date" Required
    detailMakeReq("sched_start_date", true); // to make "sched_start_date" not Required

    And users in most situations aren't fill unrequired empty fields for no reason 

     

    Regards,

    cdtj