Auto-Populate a Select List from txt/csv file 1 year 9 months ago #231422

  • Topic Author
  • snorte
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 4
  • Thanks: 0
Hello Mihaela,

Thank you very mush for the help. I sent you an example file. The idea is to read the csv file and write the data in the select list. I sent you what I need with an example about the Select List.

Thank you!!

Best regards,


Please Log in or Create an account to join the conversation.

Auto-Populate a Select List from txt/csv file 1 year 9 months ago #231436

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 414
Hello again,

I'm sending you an example form that fills in a select list based on the text.csv file that you've sent me.
Unzip the attachment that I'm sending you and install the form "formcsv (2).xml" as explained here under "How do I install a package?".

Place the text.csv file under joomla root/media/media/breezingforms/csv/text.csv . That is necessary in order for this to work.

The code which does filling in the select list with options is in Select list element > Advanced properties > Initscript. Type has to be set to Custom and Page Entry checkbox has to be checked.
function ff_sel_init(element, condition)
            type: "GET",
            url: "http://localhost/media/breezingforms/csv/text.csv",  
            success: function(data) {
                //Get values from CSV and split them in Array
                var allValues = data.split(/\r?\n|\r/);

                var redovi = [];
                //Spliting [1]->Yes and [0]->No
                var le = allValues.length;
                for(var i=0; i < le; i++) {
                redovi.push( allValues[i].split(',') );
                //Convert values to JSON string
               var stringConversion = [];
               for(var i=0; i < le; i++) {
                stringConversion.push( JSON.stringify(allValues[i] ) );

                //Passing JSON string to JSON object for ease of access
                var toJSONObj = [];
                for(var i=0; i < le; i++) {
                toJSONObj.push( JSON.parse(stringConversion[i]) );

                //Do IF statement for Values from Select list and set the proper value
               for(var i=0; i < le; i++) {
               jQuery('#ff_elem23450').append(jQuery('<option>', {
                   value: toJSONObj[i],
                   text: toJSONObj[i]


} // ff_sel_init
NOTE: In order for this to work you have to replace the url with the correct path to text.csv file (replace localhost with your site).
Furthermore, you have to replace every instance of ff_elem23450 with the ID of select list element in your form that you get by Inspecting element as shown in the picture below.

Finally, to apply this code to your form, you have to replace sel with the Name of select list element in your form.

Let me know whether you've managed to set this for your form.
If you have more questions, feel free to ask.



Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.097 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links










Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

Questions et réponses sur les forums de l'AFUJ


Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!