Results 1 to 4 of 4

Thread: add nested forms

  1. #1
    New user
    Join Date
    07-07-10.
    Posts
    6

    Default add nested forms

    Hello,
    I need to create a module with nested forms (calling many tables of the database) with a dynamic number of fields (like listwizard but recursively)
    for example if I want to create a todo list (in the backoffice), I need to add a text input for the list name under which I can add todo items. and then add another list name ... (like the attached file)

    do you have any idea?
    thanks for the help

  2. #2
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: add nested forms

    Hey jika

    You need to create own wizard. I did this way drag'n'drop permission system.

    Take a look at /system/modules/backend/OptionWizard.php
    When you are finished with php code, go to your config module and add line:
    [code=php:2wzc5oh8]<span class="syntaxdefault">
    </span><span class="syntaxcomment">/**
    ***Form*fields
    **/
    </span><span class="syntaxdefault">$GLOBALS</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'BE_FFL'</span><span class="syntaxkeyword">][</span><span class="syntaxstring">'yourWizard'</span><span class="syntaxkeyword">]</span><span class="syntaxdefault">*</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">*</span><span class="syntaxstring">'YourWizard'</span><span class="syntaxkeyword">;
    </span><span class="syntaxdefault">*</span>[/code:2wzc5oh8]
    Where YourWizard is the name of the class you created previously.

    Then, in DCA you would be able to use it with "inputType" key:
    [code=php:2wzc5oh8]<span class="syntaxdefault">
    </span><span class="syntaxstring">'asd'</span><span class="syntaxdefault">*</span><span class="syntaxkeyword">=></span><span class="syntaxdefault">*array
    </span><span class="syntaxkeyword">(
    </span><span class="syntaxdefault">****</span><span class="syntaxstring">'label'</span><span class="syntaxdefault">************** *****</span><span class="syntaxkeyword">=></span><span class="syntaxdefault">*</span><span class="syntaxkeyword">&</span><span class="syntaxdefault">$GLOBALS</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'TL_LANG'</span><span class="syntaxkeyword">][</span><span class="syntaxstring">'tl_module'</span><span class="syntaxkeyword">][</span><span class="syntaxstring">'asd'</span><span class="syntaxkeyword">],
    </span><span class="syntaxdefault">****</span><span class="syntaxstring">'exclude'</span><span class="syntaxdefault">************** ***</span><span class="syntaxkeyword">=></span><span class="syntaxdefault">*true</span><span class="syntaxkeyword">,
    </span><span class="syntaxdefault">****</span><span class="syntaxstring">'inputType'</span><span class="syntaxdefault">************** *</span><span class="syntaxkeyword">=></span><span class="syntaxdefault">*</span><span class="syntaxstring">'yourWizard'
    </span><span class="syntaxkeyword">)
    </span><span class="syntaxdefault">*</span>[/code:2wzc5oh8]

  3. #3
    New user
    Join Date
    07-07-10.
    Posts
    6

    Default Re: add nested forms

    hello

    thank you for the answer, I tried to do like you told me but now I need to call an optionWizard from my customWizard (I need to reuse the code) but I can't do it, I tried a
    $opt = OptionWizard->new() and $opt->generate()
    it displays the optionWizard but don't save the data in the database neither calls the function that should be called (in save_callback)


    do you have an idea?

  4. #4
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: add nested forms

    Why won't you copy and paste the code from OptionWizard to CustomWizard and adjust it to your needs?

    I guess you might need to use
    [code=php:557lkjqr]<span class="syntaxdefault">
    $opt</span><span class="syntaxkeyword">-></span><span class="syntaxdefault">value*</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">*serialize</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$arrValue</span><span class="syntaxkeyword">);
    </span><span class="syntaxdefault">*</span>[/code:557lkjqr]
    to pass the data. Then try to generate.

    Also check if the field in database is the BLOB type.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •