How to readonly of the TFS work item field but not hidden

[亡魂溺海] 提交于 2019-12-12 12:41:10

问题


I added new work item to tfs. for example work item type: cab, states: new, active, closed.

I added field and form element to form layout. for example customer note (type: string)

added readonly field rule on active state in process template workflow.

But it is hidden when I did'nt input text with change new to active.

why? I want to visible my field even so I did not input data.

how can I do?

thanks


回答1:


Here's the rules on ReadOnly fields for VS 2012 going forward. Note that this was NOT the behavior for VS 2010 and before. This is unfortunately undocumented and IMHO counter-intuitive.

  1. If a field is ReadOnly AND Empty, it will disappear from the form
  2. If it is only ReadOnly BUT has a value, it will still be on the form but not editable.

For example, the PBI work item has a condition that when it goes into the “Done” state, it makes both the “Business Value” and Effort field go ReadOnly as shown in the XML below from its Work Item Type Definition (WITD):

    <STATE value="Done">
      <FIELDS>
        <FIELD refname="Microsoft.VSTS.Common.BusinessValue">
          <READONLY />
        </FIELD>
        <FIELD refname="Microsoft.VSTS.Scheduling.Effort">
          <READONLY />
        </FIELD>
      </FIELDS>
    </STATE>

This forum post speaks to the behavior somewhat as well. Also, when you use the “EMPTY” attribute on a work item field, it will disappear from the form and wouldn’t you know it, “EMPTY” is a combo of “READONLY” and emptying out the field. So it all makes sense, kinda, in the end. :)




回答2:


  1. For the old form layout (TFS 2015 and prior): Add the "HideReadOnlyEmptyFields" attribute to the Layout tag and set it to false.

<FORM> <Layout HideReadOnlyEmptyFields="false"> ...

  1. For the new web layout: As of TFS 2018, you can add a "ShowEmptyReadOnlyFields" attribute to the WebLayout tag and set it to true.

<WebLayout ShowEmptyReadOnlyFields="true"> ...



来源:https://stackoverflow.com/questions/23295946/how-to-readonly-of-the-tfs-work-item-field-but-not-hidden

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!