Forms with chart from VAB can manage numerous contact forms where you can flexibly customize the content of the forms with fairly simple markup. The main direction of the plugin is polls and questionnaires with the output of results in the form of diagrams of such fields as «Check boxes», «Radio buttons», «Drop-down list» in pure css, but it is also suitable for creating other options for feedback forms, including those with the ability to send attachments , as well as write data to CSV files. Forms have built-in spam protection and more.
Docs and support
You can find more detailed information about Forms with chart from VAB on it-vab.ru.
Forms with chart from VAB needs your support
It is hard to continue development and support for this free plugin without contributions from users like you. If you enjoy using Forms with chart from VAB and find it useful, please consider making a donation. Your donation will help encourage and support the plugin’s continued development and better user support.
Privacy notices
With the default configuration, this plugin, in itself, does not:
track users by stealth;
write any user personal data to the database;
send any data to external servers;
use cookies.
In the form settings, you can activate the plugin actions:
logs the entered form data to a file for displaying the results of diagrams.
logs the entered form data to a CSV files.
Recommended plugins
None
Translations
The plugin supports the ability to translate into any language. You can use special programs for translation, such as «Poedit». By default, the plugin is only translated into Russian.
How to display form results anywhere else using shortcode?
To display the results of the form in any other place, you need to add the shortcode «VABFWC_Graphic».
For example.
1. For page and post editor
[VABFWC_Graphic id="2228" title="Title for shortcode" tag="h4" class="my_class"]
2. PHP code
echo do_shortcode( '[VABFWC_Graphic id="2228" title="Title for shortcode" tag="h4" class="my_class"]' );
Where:
id – form identifier (required);
title – text before displaying form results (optional);
tag – the tag in which the title will be wrapped (optional). Allowed tags – h1, h2, h3, h4, h5, h6, div, p, center;
class – Sets the style class for the tag (optional);
What filters exist?
VABFWC_validate_filter – Returns either true or false. If any condition returns true, the form will stop working (message will not be sent)
VABFWC_fields_filter – Returns a string to display on the screen. Allowed HTML tag with attributes «type», «id», «class», «name», «value», «checked», «onfocus», «onchange»
VABFWC_message_filter – Returns a string to display as text (message)
VABFWC_message_after_filter – Returns a string to display as text (message). Fires after a successful email has been sent.
How to use filters?
Examples of using filters:
1. VABFWC_fields_filter.
The code below will add a hidden field via the “formInput” class, which will be with a default value of “WordPress”. Only the tag without the will be output (see description above for VABFWC_fields_filter)
2. VABFWC_validate_filter. The code below will stop the form from submitting if at least one condition returns «true».
add_filter( 'VABFWC_validate_filter', 'VABFWC_filter_function', 10 );
if ( !function_exists( 'VABFWC_filter_function' ) ) {
function VABFWC_filter_function( $str ){
if ( !isset( $_COOKIE['my_cookie_agree'] ) || $_COOKIE['my_cookie_agree'] !== 'agree' ) { // first
return true;
}
if ( sanitize_text_field( $_POST['new_field'] ) !== 'WordPress' ) { // second
return true;
}
}}
Where:
The first condition checks for a «cookie» with a value of «agree» set. Let’s say you have an “I agree” button on your site that, when clicked, sets a «cookie» with the value «agree», which means that the user has consented to the use of cookies. Thus, until the user clicks the “I agree” button, the form will not work, and the life of the bots will become more complicated;
The second condition checks the value of the hidden field, if it is different from the default value («WordPress»), further processing of the form will be stopped;
3. VABFWC_message_filter. If a «cookie» with a value of «agree» is not present (the user has not consented to the use of the «cookie»), the code below will display a message to the user.
add_filter( 'VABFWC_message_filter', 'VABFWC_message_filter', 10 );
if ( !function_exists( 'VABFWC_message_filter' ) ){
function VABFWC_message_filter( $str ){
if ( !isset( $_COOKIE['my_cookie_agree'] ) || $_COOKIE['my_cookie_agree'] !== 'agree' ) {
return $str = esc_html__( 'Использование cookie отключено в настройках безопасности Вашего браузера, либо не дано согласие на их использование', 'VAB' );
}
}}
4. If we need to add filters for a particular form, we can use the global variable «post» and check the post/page id:
add_filter( 'VABFWC_validate_filter', 'my_filter_function', 10 );
function my_filter_function( $str ){
global $post;
if ( $post->ID == 1652 ) {
if ( !isset( $_COOKIE['my_cookie_agree'] ) || $_COOKIE['my_cookie_agree'] !== 'agree' ) {
return true;
}}}
5. VABFWC_message_after_filter. After successfully sending an email, we can perform any of our calculations and display their results on the screen
add_filter( 'VABFWC_message_after_filter', 'VABFWC_message_after_filter', 10 );
if ( !function_exists('VABFWC_message_after_filter') ){
function VABFWC_message_after_filter( $str ){
global $post;
if ( $post->ID == 11057 ) {
// do something
$str .= 'Hellow';
}
if ( $post->ID == 11052 ) {
// do something
$str .= 'World';
}
return $str ;
}}
Where are of the log files?
The log files are in the uploads folder. Folder structure example: