WeStandWithUkraine

75 Posts
lloyd
9 years ago
10
Topic

Hello I need to be able to populate a field with the "select type"  in my form with a csv I have downloaded.  I imported the csv using the seblod importer extension.  Reason being is I want to be able to list about 50 items from a drop down box and i'm going to be using that same field on mulitple different positions on the form.  So trying to figure out a way to populate quickly without having to type in all of those different selections over and over multiple times.  Any help would be appreciated. Thank you.

Get a Book for SEBLOD
12 Posts
Nathan
9 years ago
5
Level 1

I needed recently a countrylist with some extra value's. I made a separate content type of 'country' (which you can populate with CSV). After that, on several places I set up a field (field type: select dynamic) reading the names and values from the CCK directly. You can do this by setting the 'Query' value on 'free' and add your query. Mine looked like this: SELECT country.country_iso AS value,content.title AS text FROM #__content AS content, #__cck_store_form_country AS country WHERE content.catid = '215' and content.id = country.id;

There should be better ways. But this works fine and can be reused. I'm interested in those better ways... anyone?

75 Posts
lloyd
9 years ago
4
Level 2

Thank you that got me in the right direction, I can now pull up my dynamic fields correctly from a created table (used free query).  The problem I have now having (and have for a day or two) is that I can't seem to get my dynamic selections to save properly upon submission.  It simply just creates an entry for id in the the database and is not storing the actual selection upon submission.  It's just a blank row with the newly created id only.  I created a content type with exclusive text fields for the table to just to store all of my information for my selections. Then I created a new content type and table for my actual live form.  On the new content type I created exclusive new text fields where the user selections are going to be stored and this is where I'm actually building my site form. On that content type I then made my dynamic select field (exclusive) and have it selecting from my other table where my data is stored and that works.  On the storage part of the dynamic field I entered standard/article then the column name I wanted it to go to on the on the new table(content type) where the submissions are stored (ex: car_make which was created with the exclusive text field).  Any ideas on where I went wrong?

12 Posts
Nathan
9 years ago
3
Level 3

If I understand you correctly - you might want to try to leave the 'blabla AS value' part out of your query. How does your query look like? The 'value' part is the part you will be storing, the 'AS text' part is the part you use to show in the UI. Again... if I understand you correctly you just want the visible value (on screen) also be stored (and not the id of the content type). 

75 Posts
lloyd
9 years ago
2
Level 4

Thanks for the response.  my query is pretty simple and probably needs to be added to.  Suggestions would be welcomed as I haven't had a ton of experience with queries.


SELECT `car_make`

FROM `rkg0y_cck_store_form_cars`

ORDER BY `car_make` ASC

;


12 Posts
Nathan
9 years ago
1
Level 5

Try: 

SELECT car_make AS text, car_make AS value 

FROM #__cck_store_form_cars 

ORDER BY car_make ASC;

It should show 'car_make' and save it as the value too. 

75 Posts
lloyd
9 years ago
0
Level 6

Outstanding, thank you Nathan that worked perfectly.

75 Posts
lloyd
9 years ago
0
Level 1


9 Posts
mandrael
9 years ago
2
Level 1

Hello lloyd &alltheothers!

Are you using SEBLOD3 with the importer? I have to transfer user-data from another website to Joomla3/SEBLOD3, but after install I get a fatal error. Does the Importer only work on J3/S3?i

Fatal error: require_once(): Failed opening required '/…/administrator/components/com_cck_importerDShelpersDShelper_define.php' (include_path='.:/usr/local/lib/php') in /…/administrator/components/com_cck_importer/cck_importer.php on line 26

Best regards, Michael

75 Posts
lloyd
9 years ago
1
Level 2

I am using Seblod 3 and I have used the importer.  Although the more preferred method I found was to go into phpmyadmin and directly import the csv into my desired table.  Formatting on the csv import has to match correctly with the current table or you will get an error.  A good way to get correct format is to just export a current table as csv and update that one and go back and import it.

9 Posts
mandrael
9 years ago
0
Level 3

Hi lloyd!

Thanks for your answer!

I downloaded the old version (http://goo.gl/9iJ7Z) and now found the new version: http://www.seblod.com/products/7

The two websites for v2 and v3 are a bit confusing – currently it's a lot of "man at work" here :-) This works now. On first link it's the old version of the importer.

I think I'll prefer the importer, since I still haven't experience with importing csv into SQL …

Get a VIP membership