Fork me on GitHub

Writing a Validator  Bottom

  • I need to create a validator plugin for a project. Writing the plugin itself it not a problem, however im unable figure out how to "activate" it. I assume that it also has to follows some sort of naming convention.
    documentation does not mention anything about this. Please help.



    edited by: ccc29249, Jun 12, 2009 - 08:56 AM
  • What do you want to validate?
  • I want to validate a time format.... yes yes i know it can easily be done with a pattern, but i wanted to make it reusable for the pnForms framework, and there is an skeleton example of such a validator in the developers section. The problem is that i really have no clue how to "activate" (register it), its not in the example. Im guesing it works pretty much the same way as normal template plugins but i cant seem to get it running.
  • Haven't worked with this my self but in the documentation I found this

    Quote

    The pnFormIsValid() method will go through all validators on the page and ask them to validate themselves. If one or more validators fails then pnFormIsValid() will return false. When your code then returns false too, you tell the framework that an error occured.

    here: http://community.zik…pnFormHowToValidate

    Hope it helps.
  • Quote

    The pnFormIsValid() method will go through all validators on the page and ask them to validate themselves. If one or more validators fails then pnFormIsValid() will return false.


    I think that is the problem he is describing. how do you register the validator as 'valid' so that it won't return false?
  • craigh

    Quote

    The pnFormIsValid() method will go through all validators on the page and ask them to validate themselves. If one or more validators fails then pnFormIsValid() will return false.


    I think that is the problem he is describing. how do you register the validator as 'valid' so that it won't return false?


    I might be totally misunderstanding this, but I from the documentation I would say by simply returning true. I interpreted the problem to be: how to make sure that the validator function is called.

    ccc29249?
  • yes Dits your absolutely spot on... no matter what i do it doesnt seem to get called / Activated

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