forms:form
AJAX
ajax:delayedload ajax:event ajax:navigation ajax:region
Data
data:calendar data:column data:postrepeater data:productbrandrepeater data:productcategoryrepeater data:productrepeater data:repeater data:table data:template data:tree
Forms
forms:address forms:captcha forms:checkbox forms:checkboxgroup forms:codeeditor forms:combobox forms:datepicker forms:dialogbox forms:editbox forms:fileupload forms:form
ATTRIBUTES
EXAMPLES
forms:hidden forms:money forms:officeuseregion forms:option forms:password forms:paymentmethod forms:radiobutton forms:radiobuttongroup forms:row forms:searchbox forms:signature forms:slider forms:spinbox forms:submitbutton forms:submitimage forms:submitlink forms:successcontent forms:textarea forms:timepicker
Layout
layout:gallery layout:productgallery layout:rotator layout:stepper layout:stepperpanel layout:tablist layout:tablistitem
Logic
logic:dependency logic:else logic:if logic:include logic:parse logic:variable
Navigation
navigation:breadcrumbs navigation:item navigation:primary navigation:secondary
Personalisation
personalisation:firstname personalisation:fullname personalisation:lastname personalisation:other
Standard
standard:audio standard:embed standard:icon standard:image standard:link standard:script standard:tooltip standard:video
Templates
templates:button templates:card templates:column templates:fancybox templates:faq templates:flexlayout templates:header templates:row templates:section templates:styles templates:teammember templates:testimonial
Regions
regions:content regions:contentadditional regions:security regions:togglable
Third Party
thirdparty:googlemap thirdparty:googlemapmarker

<forms:form> </...>

Creates a HTML form with many additional options for handling its submission.

Related Tutorials

Content

any
Usually contains <forms:row> elements, containing each form item.

Attributes

action
string
The URL the form will submit to. By default, forms submit to the current page and this is the appropriate behaviour most of the time. If another page is specified here, the form will submit (and the client will navigate to) the new page. Submitting to other pages may disrupt Oncord's ability to handle the form. Default = "".
component
string
Linked component for getting and saving values
componentKey
bool
Sets the key for the component
contactGroupAdd
string
Add the contact identified by the form submission into 1 or more groups.
Contacts can be identified by a name and email address. Multiple groups can be listed separated by commas (,).
contactGroupRemove
string
Remove the contact identified by the form submission from 1 or more groups.
Contacts can be identified by a name and email address. Multiple groups can be listed separated by commas (,).
contactMode
string
Different ways to handle any Contact database fields included in the form.

Default value = no handling. Possible values:
  • "store"
    Creates a new contact if they do not exist, but doesn't fail validation if one does.
    Use case: Contact forms, enquiry or quote forms.
  • "register"
    Registers the contact and fails validation if the contact already exists.
    Use case: New user registration form where the user sets a password.
  • "subscribe"
    Ensures the user who fills this form is subscribed.
    Use case: Newsletter subscription form.
  • "guest"
    Creates a new contact if they do not exist, but does not ever log the user in.
    Use case: A tradeshow survey form or a business owned iPad / tablet registration form.
  • "login"
    Logs in the contact (requires contact_email and contact_password fields).
    Use case: A login form.
  • "logout"
    Logs out the contact.
    Use case: Logout form.
  • "unsubscribe"
    Unsubscribes the contact.
    Use case: Unsubscribe form. Requires contact_email.
contactPrefill
string
If the current user is logged in, should the form be prefilled with their details. Default = true.
controlSSubmit
bool
If ControlSSubmit is true, the form will submit when Ctrl+S is pressed on the keyboard
disableCSRF
bool
Determines if CSRF should be disabled for the current form
disableSpamPrevention
bool
Determines if spam prevention should be disabled
encType
string
The form content encoding type

Different encoding types are required for uploading different types of data.

application/x-www-form-urlencoded
Form data is encoded as name/value pairs.

multipart/form-data
Form data is encoded as a message with a separate part for each control on the page.

text/plain
Form data is encoded in plain text, without any control or formatting characters.
id
string
(Required) Give this control a unique id. Can be accessed in the client DOM (eg, document.getElementById('myid') or in the server DOM using [? $myid ?] or [? $('myid') ?]).
leavePageWarning
bool
If a user modifies the contents of a form and navigates away without saving their changes, should a warning be displayed?
method
string
The form submit method

Set to 'get' to submit form item values through the GET query string
Set to 'post' to submit form item values through the POST http headers
Set to 'ajax' to submit form item values through an AJAX xhttprequest POST. Must contain <forms:successcontents> within the form to show the sucess message.
noRefresh
bool
If no refresh is set to true, the form wont repost when refreshed
onSubmitEmail
string
If set, an email will be sent with the contents of the form to the specified email addresses. For example, a company can nominate an email address for customer feedback, and the Feedback form can email every submission to that address. Multiple address are separated by commas (,).
Using the value of true will send an email to the Contact E-mail specified in the Account Settings of the site.
onSubmitEmailAttachmentsMaxSize
string
If set, the attachments of an email cannot exceed the specified maximum size in MB
onSubmitEmailCallback
callable
When an email is sent via OnSubmitEmail you can call a custom PHP function specified the value of this attribute.

An instance of \Framework\Mail\Message will be passed as a parameter to your function prior to sending.
onSubmitEmailShowAdminLinks
bool
If true, the email sent to all addresses listed in onsubmitemail will have two links to the Oncord admin Dashboard Open Contact and View Submission. Default = true.
onSubmitEmailSubject
string
The subject of the email that will be sent to all addresses listed in onsubmitemail.
onSubmitRedirect
string
The URL to be redirected to upon successful form submission.
onSuccessToastMessage
string
If set, a green notification containing the message will briefly appear in the top-right hand corner of the page for every client when they successfully submit the form.
recordSubmissions
bool
Whether to record submissions to this form. Form submissions are viewable on the Oncord Dashboard, and are also accessible by other system components such as Automation. Generally it's a good idea to enable for any non-trivial forms where users are submitting information, such as for a feedback form. Enabling for simple forms such as login forms and email sign-up forms is not recommended as they will clutter the form submission history for your site. Default = false.
saveState
bool
When set to true, the value of all child form items is persisted when the page is revisited
onSubmitServer
callable
Called when the form is submitted
onSubmitPrerenderServer
callable
Called when the form is submitted while the document is being constructed
onPostbackServer
callable
Called when the form is submitted, regardless of validation failure
onPopulateServer
callable
Called when the form is populating values

Tutorials

Examples

Simple Form Elements

shows how to construct a basic form

HTML:

Simple form elements <forms:form> <forms:row label="I am the first Label"> <forms:editbox /> </forms:row> <forms:row label="I am the second Label"> <forms:datepicker /> </forms:row> <forms:row> <forms:submitbutton>Submit</forms:submitbutton> </forms:row> </forms:form>

Run Example

Contact Form

Note: Please see the Tutorials links at the bottom of this page.

HTML:

<forms:form id="contact_us" recordsubmissions="true" onsubmitredirect="/contact-us/success/" contactmode="store" onsubmitemailsubject="[? 'Website Enquiry: ' + $_POST['subject'] ?]" onsubmitemail="true"> <forms:row label="First and Last Names"> <forms:editbox id="contact_first_name" width="80" validations="mandatory" /> <forms:editbox id="contact_last_name" width="110" validations="mandatory" /> </forms:row> <forms:row label="E-mail Address"> <forms:editbox id="contact_email" width="200" validations="mandatory,email" transformations="tolower" /> </forms:row> <forms:row label="Phone Number"> <forms:editbox id="contact_phone" width="200" /> </forms:row> <forms:row label="Message Subject"> <forms:editbox id="subject" width="200" validations="mandatory" /> </forms:row> <forms:row type="one_column" label="Message"> <forms:textarea id="message" width="100%" rows="3" validations="mandatory" /> </forms:row> <forms:row type="one_column" align="center"> <forms:submitbutton>Submit</forms:submitbutton> </forms:row> </forms:form>

Complicated Form Example

Illistrates in depth, the user of forms

HTML:

Complicated Form Example <forms:form id="support_request" onsubmitemail="suport@yourcompany.com" onsubmitemailsubject="[? 'Support Request: ' + $_POST['subject'] ?]" contactmode="store" onsubmitredirect="/company/contact-us/success/" recordsubmissions="true"><br /> <forms:row label="*First and last name:"> <forms:editbox id="contact_first_name" width="65" validations="mandatory" placeholder="First Name" /> <forms:editbox id="contact_last_name" width="135" validations="mandatory" placeholder="Last Name" /> </forms:row> <forms:row label="*Email address:"> <forms:editbox id="contact_email" width="260" validations="mandatory,email" transformations="tolower" /> </forms:row> <forms:row label="Contact phone:"> <forms:editbox id="contact_phone" width="260" /><br /> </forms:row> <forms:row label="*Support subject:" description="For example; Contact Profile Issue."> <forms:editbox id="subject" width="260" validations="mandatory" /><br /> </forms:row> <forms:row label="Website page location:" description="Copy and paste the page address of whatever you're working on."> <forms:editbox id="support_page" width="260" /><br /> </forms:row> <forms:row label="Browser:"> <forms:editbox id="browser" width="260" value="[? (\Framework\HTTP\UserAgent::getBrowser()) + ' ' + (\Framework\HTTP\UserAgent::getBrowserVersion()) ?]" /><br /> </forms:row> <forms:row label="Operating system:"> <forms:editbox id="os" width="260" value="[? \Framework\HTTP\UserAgent::getPlatform() ?]" /><br /> </forms:row> <forms:row label="*Issue details:" description="Please explain the issue you are having, providing as much detail as possible."> <forms:textarea id="details" width="270" height="150" validations="mandatory" /> </forms:row> <forms:row label="Upload screenshot:"> <forms:fileupload extensions="IMAGE" id="screenshot" /> </forms:row> <forms:row> <forms:submitbutton>Submit</forms:submitbutton> </forms:row> </forms:form>

Using SuccessContent

Displays a success content on same page

HTML:

<forms:form id="contact_us" recordsubmissions="true" contactmode="store" onsubmitemail="true" method="ajax" onsubmitemailsubject="Website Enquiry"> <forms:row label="First Name" type="one_column"> <forms:editbox id="contact_first_name" validations="mandatory" /> </forms:row> <forms:row label="Last Name" type="one_column"> <forms:editbox id="contact_last_name" validations="mandatory" /> </forms:row> <forms:row label="Email Address" type="one_column"> <forms:editbox id="contact_email" validations="mandatory,email" transformations="tolower" /> </forms:row> <forms:row label="Message" type="one_column"> <forms:textarea id="message" height="130" validations="mandatory" /> </forms:row> <forms:row type="one_column"> <forms:submitbutton>Send</forms:submitbutton> </forms:row> <forms:successcontent> <h2 style="text-align: center;">Thank you! We've received your submission.</h2> <p style="text-align: center;">One of our staff will get back to you shortly.</p> </forms:successcontent> </forms:form>

Onsubmitserver

Execute a custom PHP function with the form values

HTML:

Complicated Form Example <forms:form id="registration_form" onsubmitserver="sendToExternalSystem($registration_form.getValues())"><br /> <forms:row label="*First and last name:"> <forms:editbox id="contact_first_name" width="65" validations="mandatory" placeholder="First Name" /> <forms:editbox id="contact_last_name" width="135" validations="mandatory" placeholder="Last Name" /> </forms:row> <forms:row label="*Email address:"> <forms:editbox id="contact_email" width="260" validations="mandatory,email" transformations="tolower" /> </forms:row> <forms:row> <forms:submitbutton>Submit</forms:submitbutton> </forms:row> </forms:form>

PHP:

<?php function sendToExternalSystem($arrValues) { // You can use cURL to make external web requests here varDump($arrValues); die(); } ?>