47 Posts
Soft M
7 years ago
Topic
Hi,

I'm creating a search form that allows search "Projects", using related fields created on "Forms & Content Types". However, for search form I need to change a type of certain field, ie, I have a field "Schools" in the creation form that is a ckeckbox and I want this same field on search form, but using a select simple instead checkbox for this field. Is this possible?


Many thanks!
Get a VIP membership
684 Posts
rpoy
7 years ago
8
Level 1
Hi Soft M,

You can use a Select Dynamic Field on the Search From.

Define the settings like so:
Table: checkbox table
options name: checkbox field
options value: id

Storage: Standard>Free>Checkbox Table > id

Hope that helps,

Randy

47 Posts
Soft M
7 years ago
7
Level 2
Hi Randy,

Thanks for your reply! I do not quite understand your solution, I'm sorry. My real question is: if field "Schools" in content type form is a checkbox, when I use this field on search type and change type to select simple, this field is also changed to in content type form. When I create a Project, I want allow to user choose one or more schools, but for search I wnat that user choose a single scool for filter search, using a select simple field.


Thank you very mutch
684 Posts
rpoy
7 years ago
6
Level 3
Hi!

Sorry for the confusion...  You are correct - If you have a Check Box on the Content form, then if you change that field in the search form to a Select Simple, it changes it on the Content Type!  This is because they are the same exact field and you are just changing the field type from a different point of view. 

So, instead of using a select simple, what you need to do is add a NEW Select Dynamic field (with the settings outlined above) to your Search form.  Then it will search on the data that you have in the database and present it in a dropdown list.

Hope that helps,

Randy

47 Posts
Soft M
7 years ago
5
Level 4
Hi Randy,

I followed your instructions and I was able to present the data as desired, but the search does not work.  =(
In form content type my checkbox is created manually instead using a database, and data is stored in a table called "#__project" (mediutext variable - like a list of schools for each project). Even so, for this issue I created a new table with the list of existing schools, but when I perform the search I get an error. I think that how I'm doing this, this search folter can not access data correctly.

Many thanks Randy
684 Posts
rpoy
7 years ago
4
Level 5
Hi Soft M,

For the new table did you use SEBLOD to create a new Content Type and then create a "Schools" checkbox?

What error are you getting?  It might be that there is not an id associated correctly.



thanks,

Randy




47 Posts
Soft M
7 years ago
3
Level 6
Sorry, it's difficult to explain...

I'll try to explain better. In content type form I was created a field that is a checkbox type. In here, I put manually the option what I want to show (School 1, School 2, School 3). In form the user can select one, two, three, (all) schools if he want. This field is saved in database as a list, for example: project_schools = School 1, School 2.

Now, in search form, I can put a filter that allow user search projects by involved schools. Then, I want a field "select simple" that shows all possible schools for user select only one school. The way I know to do this is using the same field that I created in form content type and put this field in search form.

I don't really need a separate table with schools, given that I put it manually in the form. You suggested using select dynamic, that needs a table. Then, I use a database admin to create table manually with schools name. But using this does not exist a connection between content type and search form.


Sorry for long text, I hope I've explained well.  =)
684 Posts
rpoy
7 years ago
2
Level 7
Hi Soft M,

Thank you for the clarification - The more details the better!! :)

You can not change the project_schools checkbox field to a select simple in the search form - as you stated earlier. If you do this it also changes it in the Content Type. The reason that this happens, is that they are the same exact field.

So the solution to this problem is to create an additional Select Dynamic field which will only be used on the search form. Using the settings as outlined above, this will query the information from your project_schools check box field. In the the Select Dynamic field settings you must define where to get the information from. In your case, this will be the same table as where your project_schools field is located. The options name: project_schools field name.

Another way to think about it is, your project_schools field will write the information to the database, and the Select Dynamic will read and display the information in the search form. When you select a value in the search form with the Select Dynamic, it will use the id of the project_schools field to create the query.

The difference between a Select Simple and a Select Dynamic, is that with the Select Simple you manually define the values to choose from. Select Dynamic runs a query on the database to pull the information from other fields existing fields.

With SEBLOD, you should really never need to create tables or do any database modification manually.
SEBLOD does this all for you - it is best to stay out of the database! :) Its OK to use the database to determine how and where things are being stored, but it should be reference only.

Hope that makes more sense.

Randy
47 Posts
Soft M
7 years ago
1
Level 8
Hi Randy, thank you for your patience!

You can see my configurations here. I hope this helps…! I tried what you suggested me…but doesn't work. The field that I created is showed empty, only with "select an option". One question: this solution will fetch the values which I set manually in another field?


Thanks!

4229 Posts
Kadministrator
7 years ago
0
Level 9
Hi,

instead of using select dynamic which is an overkill in this case IMHO (and you did not configure it right), you rather use select simple, all you need to do then is configure the same options as in checkbox and use the same storage (as you did withn select dynamic)
47 Posts
Soft M
7 years ago
0
Level 1
Thank you so much Klas!


This is exactly what I need. Resolved my problem!  =)

And thanks for all the help and attention Randy.
330 Posts
Kenneth
6 years ago
0
Level 1

Hello,

The linked image obviously showing the right setup of the field (regarding storage) is not available anymore.

Could you please tell me what the settings where, Soft M or Klas?

Get a VIP membership