Hi
Trying to add a search function to a connectivity table. Table opens fine in front end. But search returns a 1054. Debug does not work, in my example get messg unknown column 'members' in 'where clause'. Have not set any conditions.
Found Twincarbs post Feb 2018 and followed the instructions.
Tried to upload images but seems cant.
Events
index
{fn:member}
{view:search}
{view:member_list}
Views
member_list => data provider => {var.member}
Columns list
members.name:Name
member_misc_fields.company:Company
member_misc_fields.city:City
member_misc_fields.occupation:Occupation
member_misc_fields.email:Email
member_misc_fields.telephone:Telephone
member_misc_fields.extension:Extension
Views
search
Functions
member
Two models, related => members and member_misc_fields.
Then in the member model under searchable fields
members.name
member_misc_fields.company
member_misc_fields.city
member_misc_fields.occupation
Thanks
Instead of using "searchable fields" put them in the where conditions, set to "continue" if null. You might want to have them as LIKE %{data:fieldname}% instead of = depending on the type of field and your requirements.
Thanks, will try this.
What is the "searchable fields" used for ?
Still get same error Unknown column 'members.' in 'where clause'.
Members is the model name.
I notice that the related model add_member_fields does not have where conditions, searchable fields etc. Wonder if my prob has something to do with the related table. Because I need to set search terms on the related table too.
In the where conditions you would put model.fieldname
Screenshot of your read data action if possible please. Searchable fields are for...... No idea I never use them.
I use snag.gy , and you can put the URL in.
And from looking at that debug, it's doesn't include "name". So your 'name' field data isn't being sent. Make sure it's inside the form element.
Thanks for Snaggy
https://snag.gy/qrFopA.jpg
https://snag.gy/fy48Pl.jpg
There is no form. Using Connectivity to reflect a selection of Joomla User fields, including some related User data.
The members model is linked the Joomla Users table and does include a name field
Yes but your name field needs to be inside a form element, otherwise your web page doesn't know it needs to send the data from the field anywhere. In CC in views there is a "form" element. Put one of those submitting to index and put your field inside it.
This is how I set up Views, not working. Is this what you mean?
https://snag.gy/feHnx8.jpg
https://snag.gy/AmYSix.jpg
Think I figured what searchable fields does in the functions tab - seems it sets the fields that will be searched. This is useful.
Now have a search bar per your guide, ie text field and button. And a form area. Not sure what form area is, seems it is not visible. Still have to figure how to configure it to submit to index. I've tried putting the table url in the Action URL and/or parameters but this does not work. Thing is I dont want to specify a particular field any more. Rather let user search for name, city, company etc and then let the field list in the searchable fields function return the appropriate records.
Is this possibe? How to configure the form area ?
https://snag.gy/ohLp6U.jpg
https://snag.gy/wdj8Ym.jpg
Please see images. Seems the Send button is not triggering index.
Also
tried the solution posted by TwinCarb at
http://www.chronoengine.com/forums/posts/t105003 but cant get that to
work either. Doing a search should not be this difficult. Major challenge with deficient documentation ... .
Thanks Healyhatman
https://snag.gy/EMlk5A.jpg
https://snag.gy/Kxw1Ne.jpg
https://snag.gy/u8fNno.jpg
Should be LIKE %{data:name}% if you want to get the search term anywhere in the field instead of matching the whole thing only.
And I can't see the rest of your form area but is the button inside it too? And your read data is the one that is run in the index?
OK added the % .
Not sure if the button is inside the form area. What is a form area? See pic of Views => 4 elements ie member_list, form3, search_field and search_submit_button. Is this correct? Not sure how to get the button into the form area.
My scrolling thing wont capture whole form area page but see pic of the missing lower bit.
Yes the read data is run from index, it's called by {fn:member}
https://snag.gy/CJLqcs.jpg
https://snag.gy/uD2XRZ.jpg
https://snag.gy/X901FV.jpg
https://snag.gy/MIGOSQ.jpg
See that form3 thing in your second picture? That's the form area and your search field and button needs to be in the Content part of that.
So are the Views incorrect then, should not have search_field and search_submit_button ?
Or is it correct and I have to call them with html or php from the content box ? Not sure how to do this eg <input type="submit" value="Submit"> does not work.
put your {view:}'s inside that form area.
Careless, thanks.
Getting closer I think. Search does not have any impact on the full table list but debug shows an index event and the keyword and nothing in the button.
Also noted when I place the where conditions that you mentioned the complete list is not shown. Must be some SQL thing going on. Separating the conditions with OR seems to return all records
https://snag.gy/z1Qnpa.jpg
So your field is still called 'text4' in the form data (that's why there are two "name" fields in the setup for your text field. One is the {view} name, the other is the form data name. Rename it as well, and make sure you have your Where conditions set up properly
Presume names need not be the same?
See pic of the Where conditions
https://snag.gy/65OBnZ.jpg
https://snag.gy/bMPgN5.jpg
Your form data name is "search" so it would need to be {data:search} in that particular case.
OK so {data:search} inside the form data provider ?
On submit this is being sent /members/member-directory?conn=directory&event=index.
So seems the search term is not sent
No? In the where conditions.
Got it. Yes!!
What a struggle for me, and serious thanks to you.
A question before my next challenge.
Is there a way to send the submit by pressing Enter in the search bar?
https://snag.gy/rtvjcb.jpg
It should just work as usual, nothing special should need to be done. Semantic UI forma automatically submit on enter. If not you can force it with jquery
Thanks Healyhatman,
Cheers
The URL at the bottom would only show up if the send button was a LINK, but it's not it's a SUBMIT BUTTON. The URL it is sending the data to is the 'action="....."' tag in the form element.
If your fields are inside the FORM, and you are calling the FORM in your index event instead of the individual fields then it should be working.
Look at your debug there mate. Your field's data name appears to be "searchmember". Same issue you had 5 posts ago.
Bloody hell.
OK so the where condition name has to match the search field data name - works, thanks Healyhatman.
And added a field from the related model, separated by OR and it works too.
Thanks for your help man ... .