# 获取表单字段列表 API

获取表单字段列表,使用 GET 发起请求,请求地址为 /api/v1/forms/styles,此接口可以直接访问,无需身份验证。

GET /api/v1/forms/styles

# 请求 URI

参数名 类型 必填 说明
siteId query 整数
formId query 整数
formName query 字符串

请求 URI 可以通过传递 formId 表单 Id,也可以通过传递 formName 表单名称确定表单。

# 返回

名称 类型 说明
siteUrl 字符串 站点访问地址
styles 数组 表单样式列表
title 字符串 表单名称
description 字符串 表单简介
successMessage 字符串 表单提交成功后的提示文字
successCallback 字符串 表单提交成功后需要运行的函数
isSms 布尔值 表单是否需要短信验证
isCaptcha 布尔值 表单是否需要验证码验证
formData FormData 空表单数据对象

# 示例

# 请求示例

GET /api/v1/forms/styles?siteId=1&formName=表单名称
Content-Type: application/json

# 返回示例

{
  "siteUrl": "/",
  "styles": [
    {
      "relatedIdentity": 2,
      "tableName": "siteserver_FormData",
      "attributeName": "Name",
      "taxis": 1,
      "displayName": "姓名",
      "helpText": "请输入您的姓名",
      "list": false,
      "inputType": "Text",
      "defaultValue": null,
      "horizontal": false,
      "items": null,
      "rules": [
        { "type": "Required", "value": null, "message": "字段为必填项" }
      ],
      "isSystem": false,
      "itemValues": null,
      "ruleValues": "[\r\n  {\r\n    \"type\": \"Required\",\r\n    \"value\": null,\r\n    \"message\": \"字段为必填项\"\r\n  }\r\n]",
      "height": 0,
      "isFormatString": false,
      "relatedFieldId": 0,
      "customizeCode": null,
      "id": 27,
      "guid": "539f5617-7698-44dd-bebf-5156c986b8cb",
      "createdDate": "2023-11-15 15:53:59",
      "lastModifiedDate": "2023-11-15 15:53:59"
    },
    {
      "relatedIdentity": 2,
      "tableName": "siteserver_FormData",
      "attributeName": "Mobile",
      "taxis": 2,
      "displayName": "手机",
      "helpText": "请输入您的手机号码",
      "list": false,
      "inputType": "Text",
      "defaultValue": null,
      "horizontal": false,
      "items": null,
      "rules": [
        {
          "type": "Mobile",
          "value": null,
          "message": "字段必须是有效的手机号码"
        }
      ],
      "isSystem": false,
      "itemValues": null,
      "ruleValues": "[\r\n  {\r\n    \"type\": \"Mobile\",\r\n    \"value\": null,\r\n    \"message\": \"字段必须是有效的手机号码\"\r\n  }\r\n]",
      "height": 0,
      "isFormatString": false,
      "relatedFieldId": 0,
      "customizeCode": null,
      "id": 28,
      "guid": "5c67a7c9-2ba8-462e-9857-9f25be009d28",
      "createdDate": "2023-11-15 15:53:59",
      "lastModifiedDate": "2023-11-15 15:53:59"
    },
    {
      "relatedIdentity": 2,
      "tableName": "siteserver_FormData",
      "attributeName": "Email",
      "taxis": 3,
      "displayName": "邮箱",
      "helpText": "请输入您的电子邮箱",
      "list": false,
      "inputType": "Text",
      "defaultValue": null,
      "horizontal": false,
      "items": null,
      "rules": [
        {
          "type": "Email",
          "value": null,
          "message": "字段必须是有效的电子邮件"
        }
      ],
      "isSystem": false,
      "itemValues": null,
      "ruleValues": "[\r\n  {\r\n    \"type\": \"Email\",\r\n    \"value\": null,\r\n    \"message\": \"字段必须是有效的电子邮件\"\r\n  }\r\n]",
      "height": 0,
      "isFormatString": false,
      "relatedFieldId": 0,
      "customizeCode": null,
      "id": 29,
      "guid": "f593bff2-5cb4-4fa2-99d3-8f45ae39cced",
      "createdDate": "2023-11-15 15:53:59",
      "lastModifiedDate": "2023-11-15 15:53:59"
    },
    {
      "relatedIdentity": 2,
      "tableName": "siteserver_FormData",
      "attributeName": "Content",
      "taxis": 4,
      "displayName": "留言",
      "helpText": "请输入您的留言",
      "list": false,
      "inputType": "TextArea",
      "defaultValue": null,
      "horizontal": false,
      "items": null,
      "rules": [
        { "type": "Required", "value": null, "message": "字段为必填项" }
      ],
      "isSystem": false,
      "itemValues": null,
      "ruleValues": "[\r\n  {\r\n    \"type\": \"Required\",\r\n    \"value\": null,\r\n    \"message\": \"字段为必填项\"\r\n  }\r\n]",
      "height": 0,
      "isFormatString": false,
      "relatedFieldId": 0,
      "customizeCode": null,
      "id": 30,
      "guid": "b8e96b87-6fa4-4f1d-98a0-487c4cc769ba",
      "createdDate": "2023-11-15 15:53:59",
      "lastModifiedDate": "2023-11-15 15:53:59"
    }
  ],
  "title": "表单",
  "description": null,
  "successMessage": "表单提交成功!",
  "successCallback": null,
  "isSms": false,
  "isCaptcha": false,
  "formData": {
    "siteId": 0,
    "channelId": 0,
    "contentId": 0,
    "formId": 2,
    "isReplied": false,
    "replyDate": null,
    "replyContent": null,
    "id": 0,
    "guid": null,
    "createdDate": null,
    "lastModifiedDate": null
  }
}
上次更新: 2023/12/11 下午2:51:09