Form

Example of of result of the Form Component

The FormComponent lets you embed a Tally form on your page. It automatically converts a Tally URL into a form.

Basic Usage

The embedUrl() method outputs the code that converts your shared URL into a form.

{!! $page->form('newsletter')->embed() !!}

Note: If no form is saved, nothing will be rendered.

Decoration Options

Customize the appearance of your form by using the following decoration methods:

With Title

Displays the form title.

{!! $page->form('newsletter')->withTitle()->embed() !!}

With Padding

Applies extra padding to the form content. Without this option, the content will be aligned to the left.

{!! $page->form('newsletter')->withPadding()->embed() !!}

With Background

Adds a background to the form embed. If omitted, the form will render with a transparent background.

{!! $page->form('newsletter')->withBackground()->embed() !!}

Required

Use the required() method to mark the form field as mandatory.

{!! $page->form('newsletter')->required()->embed() !!}

Label

The label() method sets a title for the admin panel, making it easier to identify the form field in your administrative interface. This does not affect the frontend.

{!! $page->form('newsletter')->label('Newsletter Signup')->embed() !!}

Retrieving the Form Title

After defining your form component with ->form('newsletter'), use the getTitle() method to retrieve the form’s title:

<h3 class="text-2xl font-bold">{{ $page->newsletter->getTitle() }}</h3>

Checking if a Form is Set

You can verify if the user has saved valid data by using the get() method to retrieve the stored data and check its validity. This method returns the saved value as an array, or null if it not set. This is useful for conditionally rendering the form and its surroundings.

@if($page->newsletter->get())
    <div>{!! $page->tally('newsletter')->embed() !!}</div>
@endif
No more than once a month
Newsletter