How to pass registered user data from Joomla or other to Jotform

  • Profile Image
    tuyeni
    Asked on April 26, 2014 at 06:37 PM

    When a registered user on my site lets say clicks on book an appointment or something of that nature, their user data (name, address, email etc) gets passed onto a form on Jotform and they complete the rest of the fields.

     

    Also if its possible, afterward, the completed form data is also transfered back to the user account so they can see their booking when logged in.

     

    Thanks!

  • Profile Image
    EltonCris
    Answered on April 26, 2014 at 09:25 PM

    Hi,

    The first one is possible when you use your form source code or iframe embed code then apply prepopulation method. Write custom php script that grab the current login user info and then print it to the form. I think this is pretty complicated to achieved so I suggest you to hire php developer to do the job. However, if you'd like to give it a shot, you can use this as reference: http://docs.joomla.org/JFactory/getUser

    Here you can take this as an example code. This grabs the current logged in username and populates it to the form field.

    <?php

    $user = JFactory::getUser();

    if (!$user->guest) {

    $username = $user->username;

    //$realname = $user->name;

    }else{

    $username = "guest";

    }

    ?>

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="https://secure.jotformpro.com/form/40924949465972?username=<?=$username;?>" frameborder="0" style="width:100%; height:465px; border:none;" scrolling="no"></iframe>

    About your second question, I'm sorry but I have no clue how this can be achieved. I think you have to get access with your Joomla database and connect it the form. So it's basically like form to MySQL setup. You can refer to this guide, this might give you some insights. http://www.jotform.com/help/126-How-to-Insert-Update-Submissions-to-Your-MySQL-Database-Using-PHP

    Thank you!