dracoblue.net

How to validate an array with agavi

If you want to validate an array as parameter for an agavi action, you have to validate each of the array entries on its own.

Assuming we have an array called

options with the value as an array:

array(
  'title'=>'string text',
  'subtitle'=>'string subtext'
)

The following snippet validates it (every element is string - sorry for the laziness):

<validator class="string" required="true">
    <arguments base="options[]">
        <argument>title</argument>
        <argument>subtitle</argument>
    </arguments>
</validator>

Thanks to

v-dogg and wombert for the hints on how to make that.

In agavi, open source, php, validator by
@ 04 Feb 2009, Comments at Reddit & Hackernews

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About