• SharePoint提交前有效性验证


    In this article we will see how to implement client side validation in SharePoint list with out using SharePoint designer.

    For this follow the below steps

    1. 找到需要有效性验证的页面,如NewForm.aspx或者EditForm.aspx
      在URL后面输入红色部分:(http://mysite/ Lists/job/NewForm.aspx?pageview=shared&toolpaneview=2)可以进入编辑模式.
    2. 添加一个 “content editor web part” 并且修改这个web part,在代码视图中输入
    3. Add the below script
      1.<script language="javascript">
      2.function PreSaveAction()
      3.{
      4.//add your JavaScript code here and return true / false
      5.}
      6.</script>

    如:

    <script language="javascript">
    function PreSaveAction()
    {
    //add your JavaScript code here and return true / false
          var elm2 = document.getElementById("idAttachmentsTable");
             if (elm2 == null || elm2.rows.length == 0)
    {
                        alert('Please attach file!');
                 return false;
    }
                    else
    {
                        return true;  
    }
    }
    </script>

     以上代码的作用为:在提交的时候验证附件是否为空,如果空,提示必须添加附件。

    另外还可以通过http://www.codeplex.com/SPJsLib杜总发布的JS方案来检测。

  • 相关阅读:
    Django ORM 之F、Q查询与事务
    Django ORM 之基于对象、双下划线查询
    Django ORM
    Django 模板层
    Django视图层
    Django 路由控制
    Django完成常用四大功能
    Django 框架之前
    HTTP协议
    CSS-学习笔记五
  • 原文地址:https://www.cnblogs.com/ceci/p/1728731.html
Copyright © 2020-2023  润新知