Fork me on GitHub

form handler and arrays  Bottom

  • Why does

    Code

    {formtextinput id="var[0]" maxLength="64"}


    not work?

    The data array looks like:

    Code

    array(
      "var[0]" =>  "test"
    )


    instead of

    Code

    array(
      "var" => array(
        0 =>  "test"
      )
    )


    --
    https://github.com/phaidon/
  • For that nested data you need to use:

    Code

    {formtextinput id='0' group='var' ...}


    The form framework is easy to extend in new plugins to support your requirements
    Anyways, Try the group usage.
    Greetz

    --
    - Mateo T. -
    Mis principios... son mis fines
  • I have another problem:

    Code

    {formemailinput id='1' group='emails'}
    {formtextinput id='1' group='names' ...}


    Now Zikula makes a email input test for both elements even the second is text input.

    Also the result makes problem. the emails and names array are identical even I input different values.

    --
    https://github.com/phaidon/
  • Ah, yea, that same ID is indeed a problem, it's not supposed to be an "array index" but an unique identifier, so it will fail.

    I guess it would be better to extend the dropdown list in a custom plugin and make a custom "text input" HTML on the render() method to reach your goal. It's not quite clear from here, and would need another way of handle it.

    For Clip, I'm about to customize the HTML output of it's Form Plugins to allow me to handle an array of 3 levels in the form icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • The code is here:

    https://github.com/phaidon/AddressBook/blob/master/src/modules/AddressBook/templates/user/modify.tpl

    The doctrine database table contains some arrays. So it would be elegant to solve it with form arrays.

    At the moment I solved the problem with prefixes like here:

    Code

    {formemailinput id="emails_$key" group='emails' text=$emails.$key}


    --
    https://github.com/phaidon/
  • Yea
    I guess we need a formarrayinput then to produce different text inputs with:
    {formarrayinput id='emails' key=$key ...}

    I will try have it ready to add it to the incoming 1.3.1 release icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Sounds nice, but would an email validation with formarrayinput work?

    --
    https://github.com/phaidon/
  • Woot!
    Those are the details to consider while extending the framework :P

    I will see what can be an alternative to build the HTML render and capture the array of each plugin icon_wink

    --
    - Mateo T. -
    Mis principios... son mis fines
  • 0 users

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