1. Fabrik 3.7 is now available. This version contains critical security updates, please update as soon as possible. Please remember to backup your site before updating, we also recommend testing your updates on development sites if possible.

How to link forms in fabrik

Discussion in 'Community' started by mastro112, Apr 21, 2017.

  1. mastro112

    mastro112 New Member

    Level: Community
    Hello All,
    I'm new with Fabrik. I want to link some forms in Fabrik.
    I have a user form and a organisation form and when a user loggs in i want to display their info in a customers form
    I have tried a lot of things with {$my->email} I don't understand PHP i there something else i can try so that i get that info in a customersform ??
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Supporter
    I'm not sure what you mean by "when a user loggs in i want to display their info in a customers form".

    Do you mean you want to default some elements on a form to values from their Joomla user settings? So when they create a new form, things like "email" are already filled in?

    -- hugh
     
  3. mastro112

    mastro112 New Member

    Level: Community
    Yes indeed,
    I have a list and forms and groups, and i like to show some element like Adress, telephone e.o. in a new form.
    For example i have a company list with adress and all, and they have a user login. So when they login and go to the form of new gig they don't need to fill in their adress and telephone again. so this must be already filled in.
    I don't understand php.
    Sorry for my english is not very good :)
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Supporter
    OK, there's several ways to do that.

    One way is to do database lookups in the defaults for fields you want to pre-fill. So say your 'company' table has a field called 'userid', and a field called 'phone', and you want to get the company telephone for the logged on user filling out the 'gig' form (coresponding to the userid in the company table). In the email field on the gig form, put this in the default:

    Code (Text):

    $myUser = JFactory::getUser();
    $myDb = JFactory::getDbo();
    $myQuery = $myDb->getQuery(true);
    $myQuery->select('phone')->from('company')->where('userid = ' . $myUser->get('id'));
    $myDb->setQuery($myQuery);
    return $myDb->loadResult();
     
    ... and set "Eval" to Yes.

    For any other fields you want, just copy the code, and change 'phone' to the field you need ('email', 'address_line_1', whatever).

    -- hugh
     
  5. mastro112

    mastro112 New Member

    Level: Community
    I have done that but my fields are still blank.
    My form where i need to extract my data from is "ed_klantfactgegevens" and my adress from there is "adres_bedrijf"
    I have in both a field with userid
     

    Attached Files:

  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Supporter
    And this is on creating a new form (not editing an existing one)?

    Sent from my HTC6545LVW using Tapatalk
     
  7. mastro112

    mastro112 New Member

    Level: Community
    Problem solved thnxs
     

Share This Page