Take out item in filter list and have it display always

i must be blind, i still don't see the chat thing.. Essentially what i need is two fields that maybe automatically get updated when one is selected, the second updates accordingly. Not sure if that is possible with little to no coding...

for now ill just make the two dropdowns and make them required so the user knows to input it before saving the record...
 
Ok as we spoke about in live chat....

I have removed the second field and made the entries to be the full text names such as Core (UN) etc. so that is the way it should be and the records are set properly as well as filter...

the custom list template is called 2col (just edited a div or two to make the 2 column view, nothing more)

so the way you proposed was to edit the template to change the display in the record list.. you said to add a line or two of code into the default_row template under my custom list view template

Code:
if ($data == 'Union') {$data = 'U'}

So this way the following will render on status next to the names in the record list

Core (UN) will render as UN
Union (U) will render as U
NonUnion will render as N

and the filter will remain the full text label....

Updated site and ftp details so you should be good. I will be up for quite sometime finishing some other items so hit me up in this thread if you need anything further.
 
forgot to mention. The element is "Status" in the voicelink list group... Its a databasejoin to another list (which is not displayed anywhere on the site, only a backend table)...
 
I like challenging ones like this so I had a play with an idea. I actually used a dropdown element with three values.

0 - Core
1 - Union
2 - Non Union

If you select Union and save then '1' is stored in the backend. However with a PHP plugin you can modify it to always add '0' for Core, so it will store it as ["0","1"] instead. Thereby when you filter Union or Non Union it will always display core as it's a part of the filter.

The only downside is that a Union or Non Union member will always be shown in the list as a Core member as well. However will a couple of lines of code I filtered that out as well.

You will also be able to identify a TRUE core person as his entry will always be '0'.

I'm not sure if this is what you are trying to achieve though.... :D
 
But how does the filter render? Does it render with the labels or the 0,1,2?

Essentially what they were trying to do was have only Union and NonUnion display in the filter list. So no matter which you chose, Core would always be shown regardless. Whether it be all, Union or NonUnion.

A "Core" designation means they can do Union or NonUnion work so they would like it to display under both but still have the designation of core...

hmmm... But I need the Status field in the record row to show Core, Union, NonUnion and have the filter display it as well.. Doesn't matter what is actually recorded in the tables.. I just need the user appearance to be proper if you know what I mean...
 
Well it filters the labels in the front end but it uses the values in the backend, but that's how it always work.... so essentially it filters as normal.

Give me 10 minutes and I'll see if I can put it online.
 
That works. Only thing is client also wanted core out of the dropdown filter list. Not sure if thats possible to do. But the function works as I would want it.. hmmmmm this is close..
 
Can you let me know exactly what you did so i can go ahead and implement on my site? and thanks for the help.. this works exactly how they wanted it outside of removing core from the filter list
 
oh crap... you solved my issue... that is exactly what the customer wanted. Now how can I go about adding that to my site? This is VERY VERY much appreciated... challenge accepted, challenge completed, haha
 
I got absorbed into the post with the things Hugh was talking about as it sound like a good idea.

Well the filter thing may be considered a little hacky, I've removed it with PHP but I've seen it done with JavaScript once on a post on the Stackoverflow website.

The following is the How To, but Hugh would be the better judge on improvements or advise on how hacky it is. :D

So as previous mentioned I did this with a dropdown element, but you can probably do the same with a dbjoin.

For my example I used values 0, 1 and 2 for Core, Union and Non Union.

I added a PHP plugin to the form with the following code.

PHP:
// Gets the status of the dropdown, either 0, 1 or 2
$status = "{z_status___status_raw}";
// If entered as 'Core' then add him as a Union and Non Union as well so it pops up in the filters.
if ($status =='0') {
$formModel->updateFormData('z_status___status', '["0","1","2"]', true);

Replace z_status___status_raw with your full element name, the first entry needs _raw at the end.

For the list view you can use the following optional code. This stops the duplicate entries for a Core member, i.e he is shown as Core instead of Core, Union and Non Union.

Use a custom list template or just duplicate Bootstrap and call it something else.

In default.php

Just after the foreach loop

PHP:
foreach ($group as $this->_row) :

and before the load template

PHP:
echo $this->loadTemplate('row');

Enter the following

PHP:
// Filters 'Core' entry to only show 'Core'
// Otherwise each 'Core' entry will show as 'Core', 'Union' and 'Non Union'
if (strpos($this->_row->data->z_status___status,'Core') !== false) {
$this->_row->data->z_status___status = 'Core';
}

Replace z_status___status with your full element name.

Finally for the filter hack.

Just before the line that starts with
PHP:
$filter_count = array_key_exists

Enter the following

PHP:
$this->filters['z_status___status']->element = str_replace('<option value="0">Core</option>', '', $this->filters['z_status___status'']->element);


Replace z_status___status with your full element name.

This is basically looking for the entry and replacing it with nothing.

One important thing though is too check everything is 100% before you use it live. Otherwise you will have to edit entries to get them applied correctly.
 
Thanks.. This is great. Looking at your implementation it worked perfectly.. I will wait for Hugh though to give me his recommendations on this so I can move forward.. This will help me complete my app which is great.

and hacking the templates I do not mind at all. Once this site goes live it will probably never change or need an update... so as long as it works, i am good to go...

thanks again
 
I just had to edit the code snippets as I didn't realise you couldn't highlight them in colour on this forum, i.e

PHP:
This is code [COLOR=#ff0000]This is highlighted code[/COLOR] This is code

Your most welcome, if it works and gives Hugh some breathing space on the other thing then we are all happy. Well except me as it's nearly 7am and I forgot to go to bed. :D
 
I know how that is. its 3am here and I got involved in trying to finish this application.. Not sure if you saw the actual site but its located now at http://www.bakersoundstudios.com

Voice talent agency and production. They want to display audio files etc. Learned a lot in this as I am not really a coder but I understand enough to get myself in trouble, hahaha. Its on my bucket list to learn more about php and coding.. Just never seem to find the time...

It works on your site so as long as hugh gives it a thumbs up.. I will be good to go. Now just need to sort out some CSS stuff and I am good to go.
 
Ahh yes I saw that site before, I think I gave you the code changes for the side filter table. I didn't realise you were the same person.

I'm sure it will work fine on your site, just shout back if there are any problems.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top