Skip to content

Form Properties and Buttons

TinaH edited this page Aug 27, 2021 · 2 revisions
// this page
    public bool $showSave = true;
    public bool $showDelete = true;
    public bool $showReset = true;
    public bool $showGoBack = true;
    public string $saveStayBtnTxt;
    public string $saveBackBtnTxt;
    public string $onKeyDownEnter;

// see Field/Base Field/Validation
    public bool $labelsAsAttributes = true;

// see form Data
    public Model $model;
    public array $form_data;


// see form Slots
    public string $beforeFormView;

    public string $headView;
    public string $formTitle;
    public string $formSubtitle;

    public string $footerView;
    public string $formFooterTitle;
    public string $formFooterSubtitle;

    public string $afterFormView;

// see form Styling
    public bool $inline = true;
    public string $inlineLabelAlignment;


    public string $labelW;
    public string $fieldW;

// see Wrapper Layout
    public bool $wrapWithView = true;
    public string $wrapViewPath;
    public string $layout;

string saveStayBtnTxt

Override config, set the text for the Save and Stay button.

string saveBackBtnTxt

Override config, set the text for the Save and Go Back button.

bool $showSave

Show the forms save button. See Form Methods page.

bool $showDelete

Show the forms delete button. See Form Methods page.

bool $showReset

Show the forms reset button that automatically resets the form fields to the models initial value or each fields default value.

bool $showGoBack

Show the forms save and go back button. Redirects the user to the previous page after the form is successfully submitted.

string $onKeyDownEnter

  • Default: 'saveAndStay'
  • Used for wire:submit.prevent on the <form> tag,
  • Executes when the user hits the enter key, or clicks the submit button.
  • Swap it to any other method you want to run when the form is submitted

Example

    public function mount(?SomeModel $model)
    {
        $this->fill([
            'onKeyDownEnter' => 'saveAndStay', //or any other component method, remove the line if you don't want any action at all
            'showGoBack' => true,
            'showReset' => true,
            'showDelete' => false,
            'saveStayBtnTxt' => 'Next >>',
            'saveBackBtnTxt' => '<< Previous',
        ]);
        $this->mount_form($model);
    }
Clone this wiki locally