How to: Add fields to the Joomla registration form

For the most part of this week, I was working on the i-Sana website.  If you’re interested, it’s a Dutch website that offers a free digital magazine (or e-magazine) on Health.  Anyway, this was an important project for me and  I wanted to do everything just right.  So, when the bosses requested that we collected the ZIP codes of users, I tried to find a solution.

Since we’re going to be using AcyMailing to send our newsletters, we wanted to use the “core” Joomla registration form, which meant that we had to add a zip code field to it.  We pulled it off, of course.  I’m not being snobbish, but you know by now that I only discuss “problems” when I managed to solve them, right?

Anyway, below you can find the solution to add custom fields to the registration form yourself.

KNOWN PROBLEMS:  There are two known problems when using the method below.  Those problems are due to the limitations of HTML forms.

1.  You can’t set a minimum required length
2.  Users can enter spaces in your new field, instead of ‘real information’.

The steps

1. Edit your Joomla database: The first step is to edit your Joomla database; because you’ll need to store the input for your new field somewhere.  So,  open your  database using phpmyadmin (or another solution; I prefer phpmyadmin myself as it’s a tool that many ISP).  Then, make a back-up of the table (something)_users

Add a field to the table (something)_users.  The field has to be a text field.  Choose a field name that’s related to the extra field you want to create in your form; as you’ll be using this name in the next steps.

2. Editing the registration form: To add the new field to the registration form, you’ll need to edit the following file:


In the part of the code where the form is defined, add the following code:

<td height=”40″>

<label id=”zip” for=”postcode”>

<?php echo JText::_( ‘postcode’);?>:




<input class=”inputbox required” type=”text” id=”postcode” name=”postcode” size=”40″>


In this example, a new text field is added for “Postcode”.  You’ll want to changet the references to post code to the field name you used in the previous step.

3. Changing the registration logic: To ensure that the input is written to the Joomla database, you need to edit the following file:


Under “class JTabeUser extends Jtable” you’ll see the declaration of variables.  Add the following code:

“var $postcode = null;”

SUPER IMPORTANT WARNING: the code above must be typed EXACTLY as shown.  I accidentaly forgot the space after the =, and I broke the ENTIRE registration process; wondering where I made a mistake.

Of course, you’ll want to change “postcode” to the value you gave your field in step one.

4. Editing the user profile in the back-end: The extra data are now being stored in the database, but you’ll also want them to show up in the Joomla back-end.  To achieve this, edit the following file:  


Under <form action=”index.php” method=”post” name=”adminForm” autocomplete=”off”>, add the following code :

<tr> <td class=”key”>

<label for=”postcode”> <?php echo JText::_( ‘Postcode’); ?></label>


<td> <input class=”textbox” type=”text” name=”postcode” id=”postcode” size=”40″ value=”<?php echo $this->user->get(‘postcode’);?>”/>



As usual, replace ‘postcode’ with your own variable!

5.  Editing the user profile in the front-end: (added: 17/02/2010)  If you want to see the extra data in the user profiles in the front end of the site, you’ll need to make changes to the following file:


Under <table cellpadding=”5″ cellspacing=”0″ border=”0″ width=”100%”>; you’ll see that the form is being defined again.  Add the following code:

<label for=”postcode”>
<?php echo JText::_(‘Postcode’);?></label>
<td> <input class=”inputbox required” type=”text” id=”postcode” name=”postcode” size=”40″ value=”<?php echo $this->escape($this->user->get(‘postcode’));?>” >

Once again, you’ll want to change “postcode”.

And bam!  You’ve added your field to the registration procedure of Joomla.

(last edited on 17/02/2010.  Added “Editiing the user profile in the front-end after comment on the Joomla Forum)

65 thoughts on “How to: Add fields to the Joomla registration form”

  1. Pingback: Toretto's corner » How to: Add fields to the Joomla registration form

  2. Pingback: Update on “How to Add fields to the Joomla registration form « Joomla and more

    1. Gaurav Kumar

      New field is inserted in form but value is not stored in database
      i want to insert values in database

      1. Hey, did you find out how to store custom values in the database? Thank you in advance

  3. Hello, I need to add a dropdown list field to my default registration form.
    How could I do this?? I am new in all this 🙂

    Thanks a lot!

    1. The easy way out would be to answer “by replacing your textbox with a dropdown list”. But I’m guessing that that’s not much of a help for you, is it 😉
      I was trying to find an answer to your question yesterday, but I got side-tracked. I’ll try and find a solution later this week 🙂

    2. Roberto,

      First of all thanks for the posting it is very helpful. I added three new fields to my joomla registration: City, State (drop-down), and zip-code. Have not test it, will do that tomorrow.

      Adding a state drop-down. You need to follow the same steps as stated here for the text but use this code instead:

      user->get(‘state’)) : ?>
      <option value="escape($this->user->get( ‘state’ ));?>”>escape($this->user->get( ‘state’ ));?>

      Select a State



      You can probably make the drop-down dynamic, If you combine this tutorial with the steps given in

      Best, send me an email if you need the files I coded

      1. Hello, nice work i want a drop down menu too in my joomla create a account, i have already add text fields, but can you please make a utube movie so that i can see how to do?
        Do i have to change the exact files for text boxes.


      2. Hi Ray

        Could you please tell me more?
        Which type of filed did you choose for city, to have a drop down list of cities?
        Also ,I use joomla 2.5.6 and can not find these files in such directories.

        I wanna add a city field to registration form as a drop down.

        Thank you…

    3. <select name="state" class="inputbox required" id="state">
      <?php if($this->user->get('state')) : ?>
      <option value="<?php echo $this->escape($this->user->get( 'state' ));?>"><?php echo $this->escape($this->user->get( 'state' ));?></option>
      <?php else : ?>
      <option value="">Select a State</option>
      <?php endif ?>
      <option value="AK">AK</option>
      <option value="AL">AL</option>
      <option value="WV">WV</option>
      <option value="WY">WY</option>
      </select> *
      1. Ray,

        I’m glad to see that there are better coders out there than myself!

        Would you mind if I ‘devoted’ an article to your update? Of course I’ll be referring to you / your site as the source of the ‘new’ solution.

        Let me know what you think!

  4. Pingback: Add New Fields in Joomla Registration And Change Registration Mail Content

  5. Hi there i found always the same method, that is add a new row to the table of user but i want only to add a select to the form whit countrys, so this part is made, but the problem is that i want that the user name will be like matt@USA, kimberly@MEX, so the list of countrys is not a new row is only a new field to add info to the username field but i don’t know how to make this i do it in jom social whit no problems but in joomla i can´t, do you have some idea?

    In jomsocial I used a code like this username.’@’.country (of course whit other syntaxis)

    1. W,

      I’m not sure if you can do that w/ the standard Registration form. The possibities of the Joomla registration form are a bit “limited” (and it doesn’t look like that’s changing soon). I’m afraid that it’s either going to be
      impossible or would require A LOT of coding.

      I hope this answer doesn’t discourage you, though. I suggest asking your question at the Joomla forums, maybe the developers for the Joomla core files have the answer?

      I hope you find your answer soon!

    2. wolkmx, go in the user.php listed in this tutorial go in the function check and after the variables are check do a field merger. You will need to follow all the steps in this tutorial except the field creation in the database.


  6. ashfaq ahmed

    Hi can anyone tell me How to Add radio to the Joomla registration form and also it can save value

  7. Pingback: One year anniversary « Joomla and more

  8. Pingback: 2010 in review « Joomla and more

  9. I found this for very helpful guide but I need to add radio group. When the user choose the 1st option will see just 1 additional field but if he choose the second option will see 5 additional fields. I know that I have to use ajax to do that. Any hints and ideas?

  10. This was an absolute life saver! I had to adapt to the php in the website itself but this showed me the where and how. The oe thing I would add is that I was using a template from Rockethemes and the template wrote it’s own default.php, which I had to go find instead, so if you’re making changes to default.php and nothing’s happening check your template folders instead.

    Many, many thanks for this!

  11. Extra field not work with other template:
    I had follow the step above it was work for the default template, but after i change to the other template, the extra field that i was added not show, How to do ? please help…..

    1. Raymond Moncada

      The changes are per template basis. If you used a new template you need to update the template to match the steps given above.

  12. Raymond Moncada

    Steven, no you are not missing anything! My mistake, I was thinking of the Joomla 1.5 to Joomla 1.6 upgrade. -Ray

    1. Ray, I love mistakes. It’s how this blog was born!

      As for the upgrade… Personally, I haven’t tried it yet. Luckily there’s tools like JUpgrade to make things easier.

  13. I was hoping to use this article, but find that the files are totally different for joomla 1.6.

    Any help with this issue for the new joomla?



  14. Hi Steve,

    I have it open and have started on it (multi-tasking), but not sure how it will turn out just yet 🙂 Will post back…


    1. I’d appreciate that, Robert. I should really find some time to start on 1.6 tutorials, but I still have a lot to learn in 1.5… decisions, decisions!

  15. Hi,
    I was wondering if anyone could help me out.
    I want to have a checkbox in my registration form but I can’t seem to accomplish it.

    Right now I’m using a textfield and that is working like a charm.

    So the only thing I gotta do is change the textfield to a checkbox.


  16. Babatunde Sowobi

    I am following this and I think it is great work.
    Solution for 1.6 will be important. Thanks


  17. great work but i want to email certail data to the user how do i add the added field to the email wich is send to the new user

    greetz vincent netherlands

  18. thank you,
    I did all the steps, but I have two problem:

    1- when I fill the form in the front-end, nothing happens and the empty form loads again.
    2- when I fill the form in the back-end, I recieve the error “jtableuser::store failed”

    how should I solve the problem? any ideas?

  19. thanks fir this great guide!

    but I have a question…
    this method is very useful for adding textbox field, but what about other field types?
    U want to add (Age) field to the registration form in birthdate form, and showing it in the front-end as an (Age)
    how can I do it?

  20. Thaaanks duuude ! this guid helped me much more than forum and free form creator components .

    You make me happy ,hope somebody makes you happy !

  21. Steven,
    Thanks for this. I use JomSocial 2.2.4 and Jom 1.7. The very first thing the client would like his visitors to see at registration is Gender, Birthdate and County, then followed by the good ol’ standards Name, password etc…

    I can think of several ways to theroetically do this: one being Collect the data and write it directly to new fields in jos_users then populate jos_community_fieldsValues . What do you think about this process? Do you think there is a better way? Thanks for your expertise.

  22. I know this is little late, however I have only just come across this tutorial.

    i have added to form fields to the user registration form successfully. i would now like to add the extra fields to the email sent to admin.

    The fields I have added to the form are, Phone, Mobile, Address, Postcode.

    I would like this information to appear in the admin email.

    Please help. I have posted this on the joomla forum but no one can help.

  23. Hi coders,

    I am a newbie but managed to fit a custom registration form in the standard user registration process, and I have found this guide very interesting. My question may look silly, but I am going crazy to find a way to set some fields as not required, but I am not coming out of it. I have already changed the db to accept null values for those fields, but when I try to register, it simply does nothing, unless every field is compiled.

    Any (precious, vital, you win) advice?

    Thank you all

  24. Hi,
    great tutorial , guyz plz help me my backend successfully updated with nrew fields but front is nt changing a bit, i tried again nd again , all codes are corrrect but still no new field is added in front end

  25. hey many thanks to you guys Steven and Ray… works like charm… well added a user type dropdown in registration form now i want this user type to be displayed on login module… but can u tell me now how we should login as per user specified ‘user type’ …

  26. How do add fields to Joomla 2.5? There are not available form.php file at /administrator/components/com_users/views/user/tmpl/form.php…. Please help me to solve out this issue.

    1. Hi guys ! I found out how to add a new field in registration form for Joomla 2.5
      1. Go to your database and add a new field in table `users`: for exaple `lastname`
      2.Then go to xxxxxx/components/com_users/models/forms/registration.xml , where xxxxxx is your root folder.
      add this code for last name:

      Save It .

      3.Then go to xxxxxx/components/com_users/models/registration.php
      You should find a function called register
      Add this code into that function
      $data[‘lastname’] = $data[‘lastname’];
      (add it after $data[‘password’] = $data[‘password1’]; near the line 313)
      That’s it !
      Refresh your page and try it !
      It works for me !

      1. Hi guys ! I found out how to add a new field in registration form for Joomla 2.5
        1. Go to your database and add a new field in table `users`: for exaple `lastname`
        2.Then go to xxxxxx/components/com_users/models/forms/registration.xml , where xxxxxx is your root folder.
        add this code for last name:

        Save It

        Which code we have to add in xxxxxx/components/com_users/models/forms/registration.xml

  27. sureshbalaji

    how to add image upload field in joomla user registration.. please guide me…

  28. hi everyone, i’m using Joomla 1.5.x and followed the instruction carefully and i have the field present in the back-end user management, however the front end registration form is missing the field. Can any one help?

    Thank You

  29. Thanks a lot for that!! Is like mentioned above, live saver!.
    Thanks for a clear and concise explanation about change and show into ‘rest’ of views.
    When retrieved info again, some values like NIF must be blur/unfocused (not editable).

    I think this is the better solution for developers that want to increase com_user usage.
    (Mine is doing a invoicing pdf with data that default component doesn’t have, like NIF and some other)

    About validation, it can be implemented into view.php by using javascript, text long and syntax ones before send it (ie. postal code requires be 5 and be only number)

    About validation, i have a good reference of usage. It is in spanish (yo no se ruso!) but you can use G!Translator 😉 ->

  30. to admin. delete this message.

    And if you can, when i say “e NIF must be blur/unfocused (not editable).” you can edit to:
    must be readonly (ie. ) into user own data view, but not into admin 😉

    Thx a lot for vry usefull info.! Regards admin 😉

  31. I had to use a tutorial from YouTube to look how exactly I should make extra field in my registration form, but thank god, I’ve made it. The codes I’ve got from your article have been working and now I have a nice register form.
    Joomla installeren

Comments are closed.

Discover more from PowerUser Guide

Subscribe now to keep reading and get access to the full archive.

Continue reading