1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

[Solved] Reload Form?

Discussion in 'Standard Support' started by aijosh, Jul 13, 2018.

  1. aijosh

    aijosh Member

    Level: Community
    I am running a php plugin onbeforeload on a form which might require the result to add a record into the same list of the form currently loading.

    In case data was added. I need the form to load the data just added.

    I cant get it to work unless I refresh the form.

    Is it possible to get the form to refresh before loading?
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    So are you loading a new form, with blank rowid, then potentially creating a new row which you then need to load?

    The way I've done this in the past is to redirect to the new page once I know the ID of the row I just inserted ...

    Code (Text):

    $rowid = $db->insertid();
    $this->app->redirect('index.php?option=com_fabrik&view=form&formid=123&rowid=' . $rowid);
     
    -- hugh
     
  3. aijosh

    aijosh Member

    Level: Community
    Thanks,

    This works fine except it doesn't load the form in the current menu so all the modules on the page dont load.

    Is there a way to allow the reload on the same menu item (I dont want to hardcode the sef url - since it might change in the future)

    I added Itemid but it still doesn't load the sef version, you see the long url in the address bar and an entirely different view
     
    Last edited: Jul 14, 2018
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Try ...

    Code (Text):

    $rowid = $db->insertid();
    $this->app->redirect(JRoute::_('index.php?option=com_fabrik&view=form&formid=123&Itemid=123&rowid=' . $rowid));
     
     
  5. aijosh

    aijosh Member

    Level: Community
    No Luck.

    See resulting URL

    /component/fabrik/form/26/16?Itemid=243

    26 = form
    16 = row
    243 = menu
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Hmmm, that should work, if that Itemid exists. Nothing to do with Fabrik, that's J!'s main JRoute::_(), which is what we (and ever6y other J! extension) calls to get SEF'ed links, with or without an Itemid.

    Did you definitely use an upper case I on Itemid?

    -- hugh
     
  7. aijosh

    aijosh Member

    Level: Community
    Yes. Definitely.

    Its fixed though.

    Sorry I forgot to mention it was a menu item alias (If that would have helped. I dont know)

    I used the itemid for menu this alias was pointing to and it works now. Although the URL is still not the SEF url but it gets me the correct menu item

    Thanks
     
    Last edited: Jul 16, 2018

Share This Page