Skip to content

Add docs for the Form Component #630

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

Open
wants to merge 1 commit into
base: docs-for-datatable-widget
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions 7.x-dev/base-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,36 @@ The datatable will pick up everything that in your `setupListOperation()`. You c

<hr>

<a name="form"></a>
### Form

Show a form anywhere you would like. The form component allow you to display a form for your entities anywhere you would like, by using two distinct components: FormComponent and FormModalComponent. The Form Component displays the form right where there component is defined, while Form Modal Component display the form in a modal and uses ajax to retrieve the fields and validate/submit the form.

```html
<x-form
controller="\App\Http\Controllers\InvoiceCrudController"
<!-- optional -->
operation="create"
formMethod="post"
:formAction="url('my_custom_form_handler')
/>
```

The Modal Form works by generating a button where the admin can click to open the form modal.

```html
<x-form
controller="\App\Http\Controllers\InvoiceCrudController"
<!-- optional -->
operation="create"
formMethod="post"
:formAction="url('my_custom_form_handler')
modalTitle="Create an Invoice"
buttonText="Create Invoice"
buttonClass="btn btn-primary"
/>
```
<hr>

<a name="menu-separator"></a>
### Menu Separator
Expand Down