Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ module.exports = {
["/examples/alpinejs", "Alpine.js"],
["/examples/framer", "Framer"],
["/examples/gatsby", "Gatsby"],
["/examples/gridsome", "Gridsome"],
["/examples/hugo", "Hugo"],
["/examples/jekyll", "Jekyll"],
["/examples/nextjs", "Next.js"],
["/examples/nuxtjs", "Nuxt.js"],
["/examples/nuxtjs", "Nuxt"],
["/examples/react", "React"],
["/examples/react-native", "React Native"],
["/examples/sapper", "Sapper"],
["/examples/svelte", "Svelte"],
["/examples/sveltekit", "SvelteKit"],
["/examples/vue", "Vue"],
["/examples/webflow", "Webflow"],
["/examples/wordpress", "WordPress"],
Expand Down
2 changes: 1 addition & 1 deletion docs/customization/notification-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Create a hidden input with the name `_email.template.title`.
<input type="hidden" name="_email.template.title" value="My Custom Title" />
```

You can remove the title be setting the value to `false`.
You can remove the title by setting the value to `false`.

```html
<input type="hidden" name="_email.template.title" value="false" />
Expand Down
6 changes: 3 additions & 3 deletions docs/customization/redirection.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ Formspark has excellent AJAX support, [learn more about it here](/examples/ajax.

```html
<!--
1. If your form is hosted at "https:/my-website.com/newsletter.html"
1. If your form is hosted at "https://my-website.com/newsletter.html"
-->
<form action="https://submit-form.com/your-form-id">
<!-- 2. Then you would set the "_redirect" to "https:/my-website.com/newsletter.html" -->
<!-- 2. Then you would set the "_redirect" to "https://my-website.com/newsletter.html" -->
<input
type="hidden"
name="_redirect"
value="https:/my-website.com/newsletter.html"
value="https://my-website.com/newsletter.html"
/>
<input type="email" name="email" />
<button type="submit">Subscribe</button>
Expand Down
2 changes: 1 addition & 1 deletion docs/dashboard/additional-workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ workspace.

## Steps

1. Press the `+` button to rhe right of your workspace
1. Press the `+` button to the right of your workspace
2. Fill the form and press `Create`

![New workspace](../.vuepress/public/new-workspace.png)
2 changes: 1 addition & 1 deletion docs/examples/ajax.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To do so, make a `GET` or `POST` request to your form endpoint (https://submit-f
Ensure that both the `Content-Type` and `Accept` headers are set to `application/json` (some HTTP libraries do this
automatically).

We have included examples for: Axios, Fetch, jQuery and Javascript XHR.
We have included examples for: Axios, Fetch, jQuery and JavaScript XHR.

If you wish to include special fields and customizations, which require hidden fields such as `_email.subject`
and `_email.from`, include them as a nested object in the payload:
Expand Down
28 changes: 0 additions & 28 deletions docs/examples/gridsome.md

This file was deleted.

53 changes: 24 additions & 29 deletions docs/examples/nuxtjs.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
---
title: Nuxt.js
title: Nuxt
lang: en-US
---

# Nuxt.js
# Nuxt

## Fetch

```vue
<script setup>
import { ref } from "vue";

const FORMSPARK_ACTION_URL = "https://submit-form.com/your-form-id";

const message = ref("");

const submitForm = async () => {
await $fetch(FORMSPARK_ACTION_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: {
message: message.value,
},
});
alert("Form submitted");
};
</script>

<template>
<form @submit.prevent="submitForm">
<label>
Expand All @@ -17,31 +39,4 @@ lang: en-US
<button type="submit">Submit</button>
</form>
</template>

<script>
const FORMSPARK_ACTION_URL = "https://submit-form.com/your-form-id";

export default {
data() {
return {
message: "",
};
},
methods: {
async submitForm() {
await fetch(FORMSPARK_ACTION_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
message: this.message,
}),
});
alert("Form submitted");
},
},
};
</script>
```
12 changes: 6 additions & 6 deletions docs/examples/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Check out our official React hooks: [use-formspark](https://github.com/formspark
:::

```jsx
import React, { useState } from "react";
import ReactDOM from "react-dom";
import { useState } from "react";
import { createRoot } from "react-dom/client";
import { useFormspark } from "@formspark/use-formspark";

const FORMSPARK_FORM_ID = "your-form-id";
Expand Down Expand Up @@ -41,14 +41,14 @@ const Application = () => {
);
};

ReactDOM.render(<Application />, document.getElementById("root"));
createRoot(document.getElementById("root")).render(<Application />);
```

## Fetch

```jsx
import React, { useState } from "react";
import ReactDOM from "react-dom";
import { useState } from "react";
import { createRoot } from "react-dom/client";

const FORMSPARK_ACTION_URL = "https://submit-form.com/your-form-id";

Expand Down Expand Up @@ -78,5 +78,5 @@ const Application = () => {
);
};

ReactDOM.render(<Application />, document.getElementById("root"));
createRoot(document.getElementById("root")).render(<Application />);
```
42 changes: 0 additions & 42 deletions docs/examples/sapper.md

This file was deleted.

15 changes: 8 additions & 7 deletions docs/examples/svelte.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ lang: en-US

## Fetch

```html
```svelte
<script>
const FORMSPARK_ACTION_URL = "https://submit-form.com/your-form-id";

let message = "";
let submitting = false;
let message = $state("");
let submitting = $state(false);

async function onSubmit() {
async function onSubmit(event) {
event.preventDefault();
try {
submitting = true;
await fetch(FORMSPARK_ACTION_URL, {
Expand All @@ -35,8 +36,8 @@ lang: en-US
}
</script>

<form on:submit|preventDefault="{onSubmit}">
<textarea bind:value="{message}" />
<button type="submit" disabled="{submitting}">Send</button>
<form onsubmit={onSubmit}>
<textarea bind:value={message}></textarea>
<button type="submit" disabled={submitting}>Send</button>
</form>
```
57 changes: 57 additions & 0 deletions docs/examples/sveltekit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: SvelteKit
lang: en-US
---

# SvelteKit

## HTML form

The simplest integration is a plain HTML form that posts directly to Formspark.
No JavaScript is required.

```svelte
<!-- src/routes/contact/+page.svelte -->
<form method="POST" action="https://submit-form.com/your-form-id">
<textarea name="message"></textarea>
<button type="submit">Send</button>
</form>
```

## Fetch

```svelte
<!-- src/routes/contact/+page.svelte -->
<script>
const FORMSPARK_ACTION_URL = "https://submit-form.com/your-form-id";

let message = $state("");
let submitting = $state(false);

async function onSubmit(event) {
event.preventDefault();
try {
submitting = true;
await fetch(FORMSPARK_ACTION_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
message,
}),
});
message = "";
alert("Form submitted");
} finally {
submitting = false;
}
}
</script>

<form onsubmit={onSubmit}>
<textarea bind:value={message}></textarea>
<button type="submit" disabled={submitting}>Send</button>
</form>
```
Loading
Loading