What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    How to Prepopulate fields with joomla variables

    Asked by Blaick on February 19, 2016 at 02:58 AM


    I managed to prefill my form for my users with all their data (name, address, etc.), but there is an issue with the "email" field. As you can see on my screenshot, it is only written <span id=, and when I hover the box it says: "Please add '@' in the e-mail address, there is missing a symbol in '<span id='"

    Here is my code, it is pretty straightforward:




    $user = JFactory::getUser();

    $profile = JUserHelper::getProfile($user->id);

    if (!$user->guest) {

       $realname = $user->name;

       $email= $user->email;

       $street = $profile->profile['address1'];

       $city= $profile->profile['city'];

       $postcode= $profile->profile['postal_code'];

       $country= $profile->profile['country'];


       $realname = "guest";


    echo '<script type="text/javascript" src="https://form.jotform.co/jsform/60482011736853?address79[city]=' . $city. '&address79[addr_line1]=' . $street. ' &address79[postal]=' . $postcode. '&input87=' . $country . '&yourName86=' . $realname. '&yourEmail=' . $email. '"></script>';




    When I simply echo the $email variable, it works well and appears as a link at the top of my article. Maybe the problem precisely happens because this variable is a link, not a plain text...

    Any idea how to make it work?

  • Profile Image

    Answered by Boris on February 19, 2016 at 08:38 AM

    When passing variables directly into any prepopulation embed codes of your form, please try to URL encode them. This will ensure that if a variable contains any HTML character in it, such as a quote, double-quote, or any other special character, these characters will be correctly encoded into an URL and will not break your HTML codes.

    I would recommend that you please try encoding your variables with PHP urlencode, such as:


    Your echo code would be changed into something like this:

    echo '<script type="text/javascript" src="https://form.jotform.co/jsform/60482011736853?address79[city]=' . urlencode($city) . '&address79[addr_line1]=' . urlencode($street) . ' &address79[postal]=' . urlencode($postcode) . '&input87=' . urlencode($country) . '&yourName86=' . urlencode($realname) . '&yourEmail=' . urlencode($email) . '"></script>';

    I would also ask you to double-check whether the content of your $email variable actually contains just the email, and not any other HTML codes by accident.

    Please let us know whether URL encoding the variables resolves the issue you were having.

  • Profile Image

    Answered by Blaick on February 21, 2016 at 11:27 PM

    Hi Boris, 


    It worked, thanks a lot for your help!

    I was expecting the problem to be elsewhere... but that is a relief.


    Thank you again.


  • Profile Image
    JotForm Support

    Answered by beril on February 22, 2016 at 03:35 AM

    On behalf of my colleague, you are kindly welcome. We are glad to hear that the issue has been resolved for you.

    If you have any question or issues, please do not hesitate contacting us. We will be happy to assist you.