Archives

Extending the Form

Dynamic Field Settings

A field’s settings can be set dynamically when the form is rendered on the page – this is when the field data is “localized” to the page for use by the form. Related Filters add_filter( ‘ninja_forms_localize_field’, ‘my_callback’ ); add_filter( ‘ninja_forms_localize_field_’ …

Continue reading

Datepicker

The Date Field uses the Pikaday Responsive JavaScript library for datepicker functionality. This is a wrapper for the original Pikaday library. Pikaday methods for modifying the datepicker are accessible via the pikaday property of the dateObject. The ‘dateObject is passed …

Continue reading

Listening to Submit Response

After form submission, Ninja Forms sends a Backbone.Radio message that the form has been submitted. Listening to this message you can trigger custom JavaScript based on the response. // Create a new object for custom validation of a custom field. …

Continue reading

Pre-populating Fields on Display

Filter: Render Default Value apply_filters(‘ninja_forms_render_default_value’, $default_value, $field_type, $field_settings); For the “Checkbox” field, see Dynamic Default Value for the Checkbox Field. For List Field Types, see Dynamic List Fields. <?php // apply_filters('ninja_forms_render_default_value', $default_value, $field_type, $feild_settings); add_filter( 'ninja_forms_render_default_value', 'my_change_nf_default_value', 10, 3 ); …

Continue reading

Field View Rendering

When a field’s view is rendered from a template, the render:view event is triggered on multiple channels. An example of this in Ninja Forms is the rendering of the textarea field’s Rich Text Editor setting. See: RTE Example Custom Example …

Continue reading

Start/Stop Submission

The form submission process can be halted by replying to the maybe:submit request on a form specific radio channel (TODO: Add link to Radio docs). The return value (boolean) of the callback will determine if the form continues to submit. …

Continue reading

Field Submission Data

By default, a field sends anID and field value to the server for processing on form submission. This minimal payload greatly reduces the size of the submitted request, as compared to sending all associated model data for each field. In …

Continue reading

JavaScript Overview

Ninja Forms provides developers JavaScript hooks, similar to WordPress hooks in PHP, for creating custom functionality. An installable plugin example, including a custom field, a custom field template, and custom JavaScript validation is available on GitHub.

Continue reading

Custom Field Templates

Each template defines how a field, like a textbox, should be rendered. Like the WordPress page and post templating system, Ninja Forms will now look in specific locations for HTML files that represent field templates.” Form Templating Register Template File …

Continue reading

Client Side Field Validation

First, we will look at getting setup for validating a custom field, then we will look at implementing custom required validation for a custom field. Custom Validation In the below example, we are using a boilerplate JS object. Initial Setup …

Continue reading