Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

web-forms

/web-forms

Buduje publiczne formularze webowe do zbierania danych bez dostępu do Desk, takie jak formularze zgłoszeń klientów, opinii i portale samoobsługowe, we Frappe Web Forms.

Repozytorium
frappe-skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
04.08.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
1
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 04.08.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

Co robi i kiedy

Buduje publiczne formularze webowe do zbierania danych bez dostępu do Desk, takie jak formularze zgłoszeń klientów, opinii i portale samoobsługowe, we Frappe Web Forms.

Oryginalny opis (EN)

Build public-facing web forms for data collection without Desk access. Use when creating customer submission forms, feedback forms, or self-service portals with Frappe Web Forms.

Jak działa

  1. When to use
  2. Inputs required
  3. Procedure
  4. Verification
  5. Failure modes / debugging
  6. Escalation
  7. References
  8. Guardrails
  9. Common Mistakes
Sekcje z nagłówków SKILL.md, w oryginale · 187 linii, 935 słów
Podgląd SKILL.md
---
name: web-forms
description: Build public-facing web forms for data collection without Desk access. Use when creating customer submission forms, feedback forms, or self-service portals with Frappe Web Forms.
---

# Frappe Web Forms

Build public-facing web forms for data collection, submissions, and customer self-service.

## When to use

- Creating forms for external users (no Desk access)
- Building support/ticket submission forms
- Collecting customer feedback or registrations
- Enabling self-service data entry portals
- Replacing simple portal pages with form-based workflows

## Inputs required

- Target DocType for form submissions
- Which fields to expose on the web form
- Authentication requirements (login required vs guest)
- Whether users can edit/resubmit entries
- File upload requirements

## Procedure

### 0) Prerequisites

Ensure the target DocType exists and has the fields you want to expose.

### 1) Create the Web Form

1. Type "new web form" in the awesomebar
2. Enter a Title (becomes the URL slug)
3. Select the DocType for record creation
4. Add introduction text (optional, shown above the form)
5. Click "Get Fields" to import all fields, or add fields manually
6. Set field order and which are required
7. Publish the form

### 2) Configure settings

| Setting | Purpose |
|---------|---------|
| Login Required | Require authentication before form access |
| Allow Edit | Let users edit their submitted entries |
| Allow Multiple | Let users submit more than one entry |
| Show as Card | Display in card layout style |
| Max Attachment Size | Limit file upload sizes |
| Success URL | Redirect after successful submission |
| Success Message | Custom message after submission |

### 3) Make it a Standard Web Form (app-bundled)

Check "Is Standard" (visible in Developer Mode) to export the form as files:

```
my_app/
└── my_module/
    └── web_form/
        └── contact_us/
            ├── contact_us.json    # Web form metadata
            ├── contact_us.py      # Server-side customization
            └── contact_us.js      # Client-side customization
```

### 4) Add server-side customization

```python
# contact_us.py
import frappe

def get_context(context):
    """Add custom context variables to the web form."""
    context.categories = frappe.get_all("Support Category",
        filters={"enabled": 1},
        fields=["name", "label"],
        order_by="label asc"
    )

def validate(doc):
    """Custom validation before the document is saved."""
    if not doc.email:
        frappe.throw("Email address is required")

    # Prevent duplicate submissions
    existing = frappe.db.exists("Support Ticket", {"email": doc.email, "status": "Open"})
    if existing:
        frappe.throw("You already have an open ticket. Please wait for a response.")
```

### 5) Add client-side customization

```javascript
// contact_us.js
frappe.ready(function() {
    // Handle field changes
    frappe.web_form.on("field_change", function(field, value) {
        if (field === "category" && value === "Urgent") {
            frappe.web_form.set_df_property("description", "reqd", 1);
        }
    });

    // Custom validation
    frappe.web_form.validate = function() {
        let data = frappe.web_form.get_values();
        if (data.phone && !data.phone.match(/^\+?[0-9\-\s]+$/)) {
            frappe.msgprint("Please enter a valid phone number");
            return false;
        }
        return true;
    };

    // Custom after-save behavior
    frappe.web_form.after_save = function() {
        frappe.msgprint("Thank you for your submission!");
    };
});
```

### 6) Control permissions

- **Guest access**: Uncheck "Login Required" for fully public forms
- **Portal roles**: Assign portal roles to control which logged-in users see the form
- **User permissions**: Set explicit document-level permissions on the target DocType
- **Row-level access**: Use User Permission rules to restrict which records users can edit

### 7) Style the web form

Web forms use the website theme by default. For custom styling:

```html
<!-- Add custom CSS via Web Form → Custom CSS field -->
<style>
    .web-form-container { max-width: 600px; margin: 0 auto; }
    .web-form-container .form-group { margin-bottom: 1.5rem; }
    .web-form-container .btn-primary { background-color: #2490EF; }
</style>
```

## Verification

- [ ] Web form accessible at the correct URL (`/contact-us`)
- [ ] All fields render correctly
- [ ] Required field validation works
- [ ] Submission creates the correct DocType record
- [ ] Login requirement enforced (if configured)
- [ ] Edit and resubmit work (if configured)
- [ ] File uploads work within size limits
- [ ] Success message/redirect works after submission
- [ ] Custom Python validation runs on submit

## Failure modes / debugging

- **Form not accessible**: Check if published; verify URL slug
- **Permission denied on submit**: Check DocType permissions for Website User or Guest
- **Fields not showing**: Ensure fields are added to the Web Form (not just on the DocType)
- **Custom JS not loading**: Check browser console; ensure file path is correct
- **Validation not firing**: Verify `validate` function in Python file returns/throws correctly
- **Duplicate entries**: Check "Allow Multiple" setting; add custom duplicate detection

## Escalation

- For DocType schema → `doctype-development`
- For Frappe UI portal apps → `frontend-development`
- For API endpoint access → `api-development`

## References

- [references/web-forms.md](references/web-forms.md) — Web Form creation and customization

## Guardrails

- **Validate input server-side**: Never trust client validation; check in `validate()` Python method
- **Use captcha for public forms**: Enable reCAPTCHA for guest-accessible forms to prevent spam
- **Sanitize output**: Escape user-submitted data when displaying; use `frappe.utils.escape_html()`
- **Limit file uploads**: Set max file size and allowed types for attachment fields
- **Check rate limits**: Consider throttling form submissions from same IP

## Common Mistakes

| Mistake | Why It Fails | Fix |
|---------|--------------|-----|
| Missing DocType permissions | "Permission denied" on submit | Grant Create permission to Website User or Guest role |
| Not handling file uploads | Files don't attach to record | Configure Attach field properly; check upload limits |
| XSS vulnerabilities | Security risk | Escape user input in display; use `| e` filter in templates |
| Forgetting to publish form | 404 error | Check "Published" checkbox in Web Form |
| Client-only validation | Invalid data in database | Add `validate()` method in web form Python file |
| Not testing as guest user | Works for admin, fails for users | Test in incognito/logged out mode |
Pliki w paczce (2)
  • SKILL.md 7 KB
  • references/web-forms.md 2 KB

Wersje

W bazie nie ma innych skilli o nazwie web-forms.

Migawka bazy z 28.10.2026 · wersja paczki e45976d86b99 (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100frappe-web-form-builder
    Generuje Web Forms Frappe dla publicznych formularzy, takich jak portale klienta, rejestracje, ankiety i zbieranie danych.
  • 100frappe-web-form-builder
    Generuje Web Forms Frappe dla publicznych formularzy, takich jak portale klienta, rejestracje, ankiety i zbieranie danych.
  • 100frappe-portal-generator
    Generuje i konfiguruje strony portalu Frappe, trasy webowe i dynamiczną zawartość dla publicznych witryn, portali klienta i własnych widoków.
  • 100flutter-building-forms
    Buduje formularze Flutter z walidacją i obsługą danych wejściowych, na przykład ekrany logowania i formularze wielopolowe.
  • 100enhance-web-forms
    Buduje lub ulepsza formularze webowe: dostępna struktura, walidacja oparta na schemacie i spójność klienta z serwerem.
  • 100desk-customization
    Dostosowuje interfejs Frappe Desk skryptami formularzy, widoków list i raportów, oknami dialogowymi i API JavaScript po stronie klienta.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.