form

package
v1.42.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Submit = form.Submit
View Source
var Subscribe = form.Subscribe
View Source
var SubscriberAlreadyExists = errors.New("Subscriber already exists")

Functions

func Query

Types

type Form

type Form struct {
	mixin.Model[Form]

	// Name of list
	Name string `json:"name"`

	// Type of form
	Type form.Type `json:"type"`

	// Whether to send email confirmation
	SendWelcome bool `json:"sendWelcome"`

	// Overwrites default Template Id
	WelcomeTemplateId string `json:"welcomeTemplateId"`

	// Email list settings for this list
	EmailList email.List `json:"emailList,omitempty"`

	// Email forwarding
	Forward struct {
		Email   string `json:"email"`
		Name    string `json:"name"`
		Enabled bool   `json:"enabled"`
	} `json:"forward"`

	// Thank you settings
	ThankYou ThankYou `json:"thankyou"`

	// Conversion tracking info
	Facebook struct {
		Id       string `json:"id"`
		Value    string `json:"value"`
		Currency string `json:"currency"`
	} `json:"facebook"`

	Google struct {
		Category string `json:"category"`
		Name     string `json:"name"`
	} `json:"google"`

	Mailchimp struct {
		ListId string `json:"listId"`
		APIKey string `json:"apiKey"`
	} `json:"mailchimp,omitempty"`
}

func FromJSON

func FromJSON(db *datastore.Datastore, data []byte) *Form

func New

func New(db *datastore.Datastore) *Form

func (*Form) AddSubscriber

func (f *Form) AddSubscriber(s *subscriber.Subscriber) error

func (*Form) Defaults

func (f *Form) Defaults()

func (*Form) Js

func (f *Form) Js() string

func (*Form) Validator

func (f *Form) Validator() *val.Validator

type Settings

type Settings struct {
	// Name of list
	Name string `json:"name"`

	// Type of form
	Type form.Type `json:"type"`

	// Thank you settings
	ThankYou ThankYou `json:"thankyou"`
}

Settings used for injection into form.js

type ThankYou

type ThankYou struct {
	Type thankyou.Type `json:"type"`
	Url  string        `json:"url,omitempty"`
	HTML string        `json:"html,omitempty"`
}

Thank you configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL