Skip to Content Skip to Menu

Not exclusive search field in Userlist and sort priority

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
2 years 7 months ago - 2 years 7 months ago #328588 by galanopd
I understand and I always respect that. That is why I have provided a working JSfiddle example. I believe it is normal to ask this. I am not asking you to write a code for me. I only need to understand and find advise on if this issue is related to CB as I don't understand why it is not working. I have started supporting continuously with small donations (because I believe in Joomlapolis team work) and I also made very good comments in JED.
I don't think after all that I deserve

Please understand I cannot help you with custom coding.

as an answer as this is not what I ask from you.

Anyway, I had tried using .prop ( new fiddle ) but it didn't work either and I have zero errors in my console.

If you can imagine where this issue might be and provide an advise (not code) it is ok. If not, no worries.

Thanks anyway

Edit: I will work a bit more on this so don't bother answering as I might have found where the problem is

Edit2: Please accept my apologies as the problem is coding after all. Although it is not related to your suggestion but it is related to a logical error and not a syntax, I will try to work it out. In any case, please disregard my comments above, it was my fault.
Last edit: 2 years 7 months ago by galanopd.

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
2 years 7 months ago #328597 by krileon
To clarify the jQuery output from CB Auto Actions does absolutely nothing special. It simply outputs your jQuery and nothing more. The only difference you will have between it and jsFiddle or any other jQuery outputs is it automatically wraps your jQuery in document ready statement.

Seams like there's a bit of a misunderstanding here. I believe you were thinking there was a bug in CB causing your JS to not work when it's the JS itself that doesn't work due to 2 completely different HTML structures compared to the userlist search and your jsFiddle. Some comments regarding your JS are as follows.

Code:
if ($('input[name=listid]').val() === '6') {

Move this check to the auto action as a condition. Specifically the following.

Field: Custom > Value
Custom Value: [var1_listid]
Operator: Equal To
Value: 6

Code:
$('#adminForm').on("change keyup", function(event) {

There's no keyup event for forms, but change does exist and should work.

Code:
$('#adminForm > select').each(function() {

This will fail to find the fields since they're not immediate children of the form element. This is why your JS doesn't work in CB and it's because your jsFiddle doesn't match the HTML structure of our userlist so it's going to be hard for you to write working JS there. In the future use the browser developer tools (press F12) and copy the HTML structure of what you're trying to match with your JS if you want to do this from jsFiddle so you have the exact HTML structure.

Additionally something like the below should work fine to match all search inputs.

Code:
$( '#adminForm .cbFieldsContentsTab' ).find( 'input,select,textarea' ).each(function() {

It is probably even easier to just do a 1 time application of the "required" CSS class to your inputs and force that validation behavior as that basically seams like what you're wanting. The below would do this and is all the JS you'd need.

Code:
$( '#adminForm .cbFieldsContentsTab' ).find( 'input,select,textarea' ).addClass( 'required' );


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: galanopd

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

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
2 years 7 months ago #328602 by galanopd
Your help is highly appreciated, as always.

I will check carefully all your comments later on tonight and try to implement according to your instructions.

Thank you Kyle
The following user(s) said Thank You: krileon

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

  • galanopd
  • galanopd
  • OFFLINE
  • Posts: 374
  • Thanks: 49
  • Karma: 8
2 years 7 months ago - 2 years 7 months ago #328619 by galanopd
Although when all select fields were filled in, the Submit was turning to
Code:
['disabled', false]
in the case were one select field was turning back to '', the Submit was not turning to
Code:
['disabled', true]
and I could not find a way to solve it in such a way to bind all select fields under
Code:
.cbFieldsContentsTab
as you correctly commented that

There's no keyup event for forms

Therefore I solved it by changing the code and then declaring all fields one by one in the IF statement and used keyup.
Although not the perfect solution for someone having to declare many fields one by one but ok in my case as I had only 5 and now it works exactly as I wanted! Thanks.

Concerning the subject of this topic and your answer

There is no search sorting. So you can't perform a search and have it exclusively sort by the search criteria. Searching is exclusively filtering so it will reduce the result set. This means it will exclude any users that don't match the selected criteria. It's not possible from triggers either since the userlist query order by isn't exposed to any triggers.

I still wonder if there is some way to achieve it even with custom coding? It is kind of crucial for what I am doing so any advice on the steps to follow would be very helpful. As an alternative I was thinking of making another form to grab the results of the first form and then sort them they way I need and show them somehow on top of this form in another part of the page. It sounds like an awful workaround that would slow down the page dramatically but I don't find myself having more ideas so far.

Thank you
Last edit: 2 years 7 months ago by galanopd.

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

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
2 years 7 months ago #328626 by krileon

I still wonder if there is some way to achieve it even with custom coding? It is kind of crucial for what I am doing so any advice on the steps to follow would be very helpful. As an alternative I was thinking of making another form to grab the results of the first form and then sort them they way I need and show them somehow on top of this form in another part of the page. It sounds like an awful workaround that would slow down the page dramatically but I don't find myself having more ideas so far.

Only way would be to just sort by the way you want it sorted by to begin with. Sorting when set to Advanced does allow you to directly add to the ORDER BY statement of the query and you can use substitutions there, but you're not going to know if they're searching a specific field from there.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

Moderators: beatnantkrileon
Powered by Kunena Forum