How to add fields to the enrollment form

I am new (really a newcomer) to the topic of installing and configuring this platform; I have installed the Quince version through Turtor and I need to add new fields in the registration form but the documentation I find indicates that they are previous versions and/or other installation media on the one hand and on the other it is not clear to me about where I should put or make adjustments.

I kindly ask this community to tell me how and where I can make these changes that I require, highlighting the issue of being a newcomer to the subject and not having worked with previous versions.

Thank you again for any guidance you can give me.

Hi @campusedxud Welcome to Open edX!

This topic is a little confusing, because we used to have the ability to add arbitrary fields to the registration form using a custom plugin app. However now, we can only enable a predefined list of optional fields: see REGISTRATION_EXTRA_FIELDS for details. If you want more fields than these, you’ll need to write some code.

But to add the predefined extra fields to the registration form, you just need to change some settings used to run your Open edX application.

  1. Create a small Tutor plugin like this example repo.

  2. Update your custom repo to provide settings like this:

    ENABLE_DYNAMIC_REGISTRATION_FIELDS = True
    # Mark the fields you want to add to be required / optional / optional-exposed
    REGISTRATION_EXTRA_FIELDS = {
        'confirm_email': 'hidden',
        'level_of_education': 'optional',
        'gender': 'optional',
        'year_of_birth': 'optional',
        'mailing_address': 'optional',
        'goals': 'optional',
        'honor_code': 'required',
        'terms_of_service': 'hidden',
        'city': 'hidden',
        'country': 'hidden',
    }
    

Best regards @jill

I appreciate your response and guidance on the matter; analyzing the code you shared, I cannot find fields that are useful to me, so it is necessary to create them; Could you guide me on how and where I can create them so that they can be displayed in the mfe, please?

I greatly appreciate any instructions you can give me.

Hi @campusedxud , I’d recommend that you:

  1. Read the Tutor plugin tutorial: Creating a Tutor plugin — Tutor documentation
  2. Create a new tutor plugin using GitHub - overhangio/cookiecutter-tutor-plugin: Cookiecutter for tutor plugins
  3. Add a file to your repo under tutor-<your-plugin>/patches/ called common-env-features, which contains the following content:
    ENABLE_DYNAMIC_REGISTRATION_FIELDS = True
    # Mark the fields you want to add to be required / optional / optional-exposed
    REGISTRATION_EXTRA_FIELDS = {
        'confirm_email': 'hidden',
        'level_of_education': 'optional',
        'gender': 'optional',
        'year_of_birth': 'optional',
        'mailing_address': 'optional',
        'goals': 'optional',
        'honor_code': 'required',
        'terms_of_service': 'hidden',
        'city': 'hidden',
        'country': 'hidden',
    }
    
  4. Install your plugin to your Tutor’s requirements by installing it in tutor’s virtual environment:
    (tutor) $> pip install git+https://github.com/<your-plugin>
    
  5. Check that your plugin is listed when you run:
    (tutor) $> tutor plugins list
    
  6. Enable your plugin
    (tutor) $> tutor plugin enable <yourplugin>
    
1 Like