• Resolved MrSrc

    (@mrsrc)


    Hey! Thank you for your plugin, nice work.
    Here what i want to make with this plugin:
    I need to build something like ticket system ( we have few fields [username] [title] …. [file 1] and etc. ).
    So, i need documentation and tips for how can i make custom validation ( i mean after data passed standard form validation, i can check file size, … and insert data into tables i need).
    I visited your site with hope to find some documentation ( documentation section and other ), but it seems to be deleted or not created yet.
    Help me please.
    P.S: Sorry for my English

    https://www.ads-software.com/plugins/guiform/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter MrSrc

    (@mrsrc)

    In case you upgrading plugin documentation, give us old version please .

    Plugin Author russellpabon

    (@russellpabon)

    Hi,

    In the root directory of GuiForm rename the file

    functions-sample.php

    to

    functions.php

    .
    You can create your own class or modify the existing example and use WordPress hook

    add_action

    and

    dd_filter

    .

    This hook accept two parameter and return none. First parameter are the entry value and the second is the form object property.

    function saveEntry($data, $form){
    //Your code here!
    }
    add_action('guiform_action_{Form ID}_save_entry', 'saveEntry', 10, 2);
    add_action('guiform_action_1_save_entry', 'saveEntry', 10, 2);

    The current version doesn’t have hooks for custom validation. If you want to add validation for file size you need to edit the

    classes/GuiForm/Module/Validator.php

    .

    Find this code:

    if($value['type'] == 'f_file'){
    $validators['file'] = array('extension' => $value['validation']['extension']['type'],
    'type' => $value['validation']['extension']['mime'],
    'message'  => $value['validation']['extension']['text']);
    }

    And change this to:

    if($value['type'] == 'f_file'){
    $validators['file'] = array('extension' => $value['validation']['extension']['type'],
    'type' => $value['validation']['extension']['mime'],
    'maxSize' => 5*1024*1024,// 5 MB
    'message' => $value['validation']['extension']['text']);
    }

    Documentation and video tutorial will be release soon.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Documentation & some tips’ is closed to new replies.