new form in edit mode

Im going to make a new ajax form after save current form and redirect to edit mode.
what is the best solution to do that.
on_after_save() or make custom hook or something else.
and how can make changes on edit mode with hooks.
thanks

Comments

  • edited 11:45AM
    A couple questions first.

    1. Is the form located where a normal module form is (e.g. fuel/my_module/edit/1)?
    2. If so, what are you using to trigger the save for this AJAX form?
  • edited March 2015
    Hi, yes it is located normal module like user list.
    for instance, in create user, when I create new user and save it (and redirect to edit mode)
    I wana show a sub form under user form to add some Data for user created.
    user table has one to many relation with data table.
    I just planing to find best solution to do that.
    thanks.

    sorry for my bad english
  • edited 11:45AM
    Is this data associated with the user simply just "meta" data that needs to get saved in a related "meta_user" type table?
  • edited 11:45AM
    No, I mean each user has some classes in school and I want to add user classes under user edit form (ajax form).
    on_after_save() doesnt render html data into user form.
    I added some line of code to fuel/views/_layout/admin_main.php for create extra html form on my condition:
    $this->load->module_view(FUEL_FOLDER, '_blocks/extra_form', $out);

    Is this right way?
    it is work for me but I got some error like:
    core\Loader.php(332) : eval()'d code on line 2
  • edited 11:45AM
    You could try using the repeatable field and use the on_after_save model hook to save that information to the associated table:
    http://docs.getfuelcms.com/general/forms#template

    This field type creates a $_POST array variable like so $_POST['user_classes'][0]['class_id']. You can then target this data in your on_after_save hook in your model.
Sign In or Register to comment.