Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/14573 support more types in form #15093

Merged
merged 3 commits into from
Mar 6, 2025

Conversation

crazywoola
Copy link
Member

Summary

Add more types in the markdown form.

Supported Types

enum SUPPORTED_TYPES {
  TEXT = 'text',
  PASSWORD = 'password',
  EMAIL = 'email',
  NUMBER = 'number',
  DATE = 'date',
  TIME = 'time',
  DATETIME = 'datetime',
  CHECKBOX = 'checkbox',
  SELECT = 'select',
}

Form Content

<form data-format="json"> // Default to text
  <label for="username">Username:</label>
  <input type="text" name="username" />
  <label for="password">Password:</label>
  <input type="password" name="password" />
  <label for="content">Content:</label>
  <textarea name="content"></textarea>
  <label for="date">Date:</label>
  <input type="date" name="date" />
  <label for="time">Time:</label>
  <input type="time" name="time" />
  <label for="datetime">Datetime:</label>
  <input type="datetime" name="datetime" />
  <label for="select">Select:</label>
  <input type="select" name="select" data-options='["hello","world"]'/>
  <input type="checkbox" name="check" data-tip="By checking this means you agreed"/>
  <button data-size="small" data-variant="primary">Login</button>
</form>

DSL File

ChatForm.yml.zip

Screenshots

Before After
old-types new-types

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@crazywoola crazywoola linked an issue Mar 6, 2025 that may be closed by this pull request
5 tasks
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 💪 enhancement New feature or request 📚 documentation Improvements or additions to documentation labels Mar 6, 2025
@crazywoola crazywoola removed the 📚 documentation Improvements or additions to documentation label Mar 6, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 6, 2025
@crazywoola crazywoola merged commit 8369e59 into main Mar 6, 2025
9 checks passed
@crazywoola crazywoola deleted the feat/14573-support-more-types-in-form branch March 6, 2025 09:38
@dosubot dosubot bot mentioned this pull request Mar 6, 2025
5 tasks
@crazywoola
Copy link
Member Author

@gdamao It is available in v1.0.1

jackzhuo pushed a commit to jackzhuo/dify that referenced this pull request Mar 14, 2025
@gdamao
Copy link

gdamao commented Mar 21, 2025

It would be better if it could support file uploads using input type="file".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support more types in form
4 participants