Fork me on GitHub

pnForm + javascrìpt validation  Bottom

  • icon_confused Hi is possible design forms with pnForms but including javascript validation using /javascript/ajax/validation.js file? there are some integration?

    Thanks
  • Hi,

    there is no special support for the Prototype validation class in pnForm. But it is also not impossible to combine them basically. IIRC you can just add the validation like you would do it with a normal form. Do not forget to use the pnpageaddvar plugin to reference the JavaScript file icon_wink

    --
    Guite | ModuleStudio
  • I modified files: block.pnform.php adding:

    Code

    // Add for prototype validation support
        $prototypeValidation = isset($params['prototype']) ? true : false;
        if($prototypeValidation)
        {
            PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
            PageUtil::AddVar('javascript', 'javascript/ajax/validation.js');
            PageUtil::AddVar('javascript', 'javascript/ajax/effects.js');
        }


    and:

    Code

    // Add for prototype validation support
        if($prototypeValidation)
        {
            $out .= '

        function pValidate()
        {
            var valid = new Validation(\'pnFormForm\',{onSubmit:false}).validate();
            return valid;
        }
    '
    ;
        }


    and also pnformtextinput.php and function.pnformbutton.php for support it, but I don't know if it is the best solution because are core files... what do you think? maybe I can send it like SVN patch?
  • Yes, please submit this as a patch. But it probably won't be included in .8, but in the next version because of the feature freeze.

    --
    Guite | ModuleStudio

This list is based on users active over the last 60 minutes.