form-builder

form-builder

熱門

使用 docassemble 建立互動式文件表單與問卷

316星標
70分支
更新於 2026/1/31
SKILL.md
唯讀
名稱
form-builder
描述

使用 docassemble 建立互動式文件表單與問卷

版本
1.0

表單建置技能

概述

本技能可讓您使用 docassemble 建立智慧型文件表單——這是一個透過引導式問卷產生文件的平台。您可以建立根據回答動態調整的問卷。

使用方式

  1. 描述您需要的表單或文件
  2. 指定條件邏輯需求
  3. 我將為您建立 docassemble 問卷 YAML

範例提示:

  • 「為新客戶建立一份資料填寫表單」
  • 「建立一份法律文件的條件式問卷」
  • 「產生一份合約生成的多步驟表單」
  • 「設計一份互動式文件組合表單」

領域知識

問卷結構

metadata:
  title: 客戶資料表
  short title: 資料表

---
question: |
  請問您的姓名?
fields:
  - 名字: first_name
  - 姓氏: last_name

---
question: |
  您需要哪一種服務?
field: service_type
choices:
  - 合約審閱
  - 文件草擬
  - 諮詢

---
mandatory: True
question: |
  謝謝您,${ first_name }!
subquestion: |
  我們將針對您的 ${ service_type } 需求與您聯繫。

條件邏輯

---
question: |
  您是公司還是個人?
field: client_type
choices:
  - 公司
  - 個人

---
if: client_type == "公司"
question: |
  請問您的公司名稱?
fields:
  - 公司名稱: company_name
  - 統一編號: ein
    required: False

---
if: client_type == "個人"
question: |
  請問您的出生日期?
fields:
  - 出生日期: birthdate
    datatype: date

欄位類型

fields:
  # 文字
  - 姓名: name
  
  # 電子郵件
  - 電子郵件: email
    datatype: email
  
  # 數字
  - 年齡: age
    datatype: integer
  
  # 金額
  - 金額: amount
    datatype: currency
  
  # 日期
  - 開始日期: start_date
    datatype: date
  
  # 是/否
  - 同意條款?: agrees
    datatype: yesno
  
  # 單選
  - 顏色: color
    choices:
      - 紅色
      - 藍色
      - 綠色
  
  # 複選
  - 選擇選項: options
    datatype: checkboxes
    choices:
      - 選項 A
      - 選項 B
  
  # 檔案上傳
  - 上傳文件: document
    datatype: file

文件產生

---
mandatory: True
question: |
  您的文件已準備就緒。
attachment:
  name: 合約
  filename: contract
  content: |
    # 服務協議
    
    本協議由 **${ client_name }**
    與 **服務提供者** 共同簽訂。
    
    ## 服務內容
    ${ service_description }
    
    ## 付款
    總金額:${ currency(amount) }
    
    日期:${ today() }

範例:客戶資料填寫

metadata:
  title: 法律客戶資料表
  short title: 資料表

---
objects:
  - client: Individual

---
question: |
  歡迎使用我們的資料填寫表單。
subquestion: |
  請回答以下問題。
continue button field: intro_screen

---
question: |
  請問您的姓名?
fields:
  - 名字: client.name.first
  - 姓氏: client.name.last
  - 電子郵件: client.email
    datatype: email
  - 電話: client.phone
    required: False

---
question: |
  這是哪一類案件?
field: matter_type
choices:
  - 合約: contract
  - 爭議: dispute
  - 諮詢: advisory

---
if: matter_type == "contract"
question: |
  合約詳細資訊
fields:
  - 合約類型: contract_type
    choices:
      - 僱傭
      - 服務協議
      - 保密協議
  - 他方當事人: other_party
  - 預估價值: contract_value
    datatype: currency

---
mandatory: True
question: |
  謝謝您,${ client.name.first }!
subquestion: |
  **摘要:**
  
  - 姓名:${ client.name }
  - 電子郵件:${ client.email }
  - 案件類型:${ matter_type }
  
  我們將在 24 小時內與您聯繫。

資源