Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #2969
      Jason
      Keymaster

      Here’s a simple address group:

      piklist('field', array(
        'type'    => 'group',
        'field'   => 'address',
        'template'=> 'field',
        'fields'  => array(
          array(
            'type'    => 'text',
            'field'   => 'street',
            'label'   => 'Street Address',
            'columns' => 12
          ),
          array(
            'type'    => 'text',
            'field'   => 'city',
            'label'   => 'City',
            'columns' => 4
          ),
          array(
            'type'    => 'select',
            'field'   => 'state',
            'label'   => 'State',
            'choices' => $states,
            'columns' => 4
          ),
          array(
            'type'    => 'text',
            'field'   => 'zip',
            'label'   => 'Zip Code',
            'columns' => 4,
            'validate'=> array(
              'type'    => 'zip-code'
            )
          )
        )
      ));

      The code for the zip-code type can be found here: https://github.com/JasonTheAdams/PiklistHelper/blob/master/PiklistHelper.php#L88

      I have had issues with validations in the past being finicky — in that they don’t always work. I’m not sure if something was changed that broke my old code, but the docs don’t seem to have changed.

    • #2970
      Steve
      Keymaster

      @jason– Did you verify your regular expression is working properly?

    • #2971
      Jason
      Keymaster
    • #2972
      Jason
      Keymaster

      And, to clarify, when I say “not work” I mean that the validation never fails.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.