Skip to content

Commit

Permalink
feat(docs): Explain how to use QBtn type submit in QField marginalia …
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Oct 22, 2019
1 parent 9677988 commit f6aec2f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/src/pages/vue-components/button.md
Expand Up @@ -65,6 +65,18 @@ The example below won't work with UMD version (so in Codepen/jsFiddle too) becau
### Controlling the button for form submission
When you have a button to submit a form's input to the server, like a "Save" button, more often than not you will also want to give the user the ability to submit the form with a press of the ENTER key. If you would also like to give the user feedback of the saving process being in progress, and to prevent the user repeatedly pressing the button, you would need the button to show a loading spinner and be disabled from click events. QBtn allows this behavior if configured so.

::: warning
When a QBtn with type "submit" is placed inside one of the before, after, prepend, or append slots of QField, QInput or QSelect, all `@click` events are prevented.
:::

This means that a QBtn with type "submit" placed in one of these slots will not trigger the submission of the form this component is placed into.

::: tip
To perform form submission with a QBtn with type "submit" placed in one of these slots add a `@click` listener on QBtn that calls the method that submits the form.
:::



<doc-example title="Form Submission" file="QBtn/FormSubmission" />

## QBtn API
Expand Down
12 changes: 12 additions & 0 deletions docs/src/pages/vue-components/field.md
Expand Up @@ -96,6 +96,18 @@ Most of the form controls always render something visible, so you if you're usin

<doc-example title="Prefix and suffix" file="QField/PrefixSuffix" />

### Before, after, prepend, or append slots with QBtn type "submit"

::: warning
In order to prevent unwanted interactions between the content of these slots and the rest of the component, all `@click` events are prevented.
:::

This means that a QBtn with type "submit" placed in one of these slots will not trigger the submission of the form this component is placed into.

::: tip
To perform form submission with a QBtn with type "submit" placed in one of these slots add a `@click` listener on QBtn that calls the method that submits the form.
:::

### Loading state

<doc-example title="Loading state" file="QField/LoadingState" />
Expand Down
12 changes: 12 additions & 0 deletions docs/src/pages/vue-components/input.md
Expand Up @@ -114,6 +114,18 @@ When you need QInput to grow along with its content, then use the `autogrow` pro

<doc-example title="Prefix and suffix" file="QInput/PrefixSuffix" />

### Before, after, prepend, or append slots with QBtn type "submit"

::: warning
In order to prevent unwanted interactions between the content of these slots and the rest of the component, all `@click` events are prevented.
:::

This means that a QBtn with type "submit" placed in one of these slots will not trigger the submission of the form this component is placed into.

::: tip
To perform form submission with a QBtn with type "submit" placed in one of these slots add a `@click` listener on QBtn that calls the method that submits the form.
:::

### Debouncing model

The role of debouncing is for times when you watch the model and do expensive operations on it. So you want to first let user type out before triggering the model update, rather than updating the model on each keystroke.
Expand Down
12 changes: 12 additions & 0 deletions docs/src/pages/vue-components/select.md
Expand Up @@ -36,6 +36,18 @@ As a helper, you can use `clearable` prop so user can reset model to `null` thro
### Disable and readonly
<doc-example title="Disable and readonly" file="QSelect/DisableReadonly" />

### Before, after, prepend, or append slots with QBtn type "submit"

::: warning
In order to prevent unwanted interactions between the content of these slots and the rest of the component, all `@click` events are prevented.
:::

This means that a QBtn with type "submit" placed in one of these slots will not trigger the submission of the form this component is placed into.

::: tip
To perform form submission with a QBtn with type "submit" placed in one of these slots add a `@click` listener on QBtn that calls the method that submits the form.
:::

### Menu transitions

::: warning
Expand Down

0 comments on commit f6aec2f

Please sign in to comment.