0

我试图找出如何控制自定义编辑表单上的共享点字段。我需要显示/隐藏该字段,具体取决于同一表单上相关 Web 部件中的列值内的 si。我认为 jquery 会解决它;webpart 是使用连接的子视图创建的。有任何想法吗?

4

1 回答 1

1

You can use http://aymkdn.github.io/SharepointPlus/ to do it :

<script type="text/javascript" src="filelink/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="filelink/sharepointplus-3.0.4.min.js"></script>
<script language="javascript" type="text/javascript">
// do your test
if (/*your condition is */true) {
  $SP().formfields('Field to hide').row().hide()
}
</script>

If you don't want to use SharepointPlus, then it will depend:

  1. test the "title" property of the field. For example if your column is called "First Name" and is a "input text" field, then you can do :

    jQuery("input[title='First Name']").closest('tr').hide()
    
  2. if the "title" property doesn't work (all the Sharepoint fields don't use it), then you have to test all the "NOBR" tags in your page and look at the content to see if it's one of the field. For example if you want to hide the "username" column :

    jQuery('nobr').each(function() {
      var $this=$(this);
      if ($this.text() == "username") { $this.closest('tr').hide(); return false }
    })
    
于 2013-05-19T10:02:25.470 回答