Dropdown to events

ieraora 16 Feb, 2020
Hello, I search an Idea...
I would create a dropdown (with button) with selects that run events like PUBLISH SELECTED, but I'm very unskilled

I've only create

VIEWS > DROPDOWN > NAME various_events
OPTIONS
publish_selected= PUBLISH SELECTED
unpublish_selected= UNPUBLISH SELECTED

VIEWS > TOOLBAR BUTTON > NAME toolbar_button55 > LIST VIEW NAME articles_list

How can I connect first option (publish_selected) to FUNCTION publish_articles_group and second option to another FUNCTION?

Thank for you reply.
healyhatman 17 Feb, 2020
Can you share a screenshot of your view so I can better understand how you're organising your data?
healyhatman 17 Feb, 2020
The problem here is that the articles_list is one "form", and the select is in a separate form, so it won't have the data from both. It would probably be better to have a "publish" button and an "unpublish" button. They can both submit to the same event, just append say &action=publish or &action=unpublish to the URL and perform the appropriate action.
ieraora 17 Feb, 2020
Thank you healyhatman for your reply. Publish and unpublish is only an example for us, I need to add at least 6 options (public/private... buy/free).
what do you mean with "separate form"?
healyhatman 17 Feb, 2020
The "list view name" option for the toolbar button is actually referencing the name of a FORM element. When you submit a form on a website it submits ONE form element. The buttons are outside of the the form referenced by the list view name option - namely, the list (which will be wrapped inside <form> tags).

So the only way to do it is to either wrap the whole lot of it in form tags (so use a Form Area, put {view:your_buttons} and {view:your_list} inside it, and in your toolbar button set the "list view name" to the name of that parent form element, or do what I said, or make your own jQuery code to submit the value of the dropdown along with the list selections.
ieraora 17 Feb, 2020
Sorry, but the list view name for me is refering to a TABLE VIEW

Dropdown to events image 5

Dropdown to events image 6


I need to 6 options to change these columns. Repeate, piublish/unpublish was only to do simple the ticket
healyhatman 17 Feb, 2020
Yes, "list view name" for you references a table. But if you look at the code, you will see a <form> tag surrounding the table. So REALLY it's referencing a <form> element on the page. That's why you can put the NAME of a form area on there, and it will submit the data from the referenced form.

You can right click your table and click "inspect element" and have a look if you don't believe me.
ieraora 17 Feb, 2020
Ok. but really there isn't a way with CC6 to reach this solution? Is difficult for me think this. Can I open a ticket?
healyhatman 17 Feb, 2020
I already explained 3 options for doing it. It's not a "CC6 problem", it's a "way the internet browsers and HTML forms have been designed to work for the past 30 years" thing.


Best option: use a Form Area, put your toolbar, select, table view, everything inside it. Your toolbar button's "list view name" set to the name of the form area.
ieraora 17 Feb, 2020
Ok, done. See below, Is correct?
Now how can I implement events with various options of select?

Dropdown to events image 7


Dropdown to events image 8

Dropdown to events image 9
healyhatman 17 Feb, 2020
Your read data actions {fn:} can stay outside the form area, it's the VIEWS that need to be inside it.

Put a {debug:} in the event you're submitting to, and click your toolbar button and you should be able to see all the data available to you. Use an event switcher accordingly.
ieraora 17 Feb, 2020
I've this error.
Dropdown to events image 10




And is correct a switcher like this?

Dropdown to events image 11
ieraora 18 Feb, 2020
Sorry, there are no suggestions?
healyhatman 18 Feb, 2020
Turn off "require selection" in the toolbar button.

That data provider has an extra } at the end which shouldn't be there. And pretty sure you want {data:name_of_dropdown}
ieraora 19 Feb, 2020
This is my work, Where I wrong?


Dropdown to events image 12

Dropdown to events image 13



Dropdown to events image 14

Dropdown to events image 15
Dropdown to events image 16


Dropdown to events image 17


Dropdown to events image 18


Dropdown to events image 19
healyhatman 19 Feb, 2020
Your list needs to be inside the form as well
ieraora 19 Feb, 2020
Dropdown to events image 20
Dropdown to events image 21




Array
(
    [cont] => manager
    [conn] => BE_gestione_galleria-toogle-copy
    [event] => try_dropdown
    [select54] => publish_selected
    [gcb] => Array
        (
            [0] => 320
            [1] => 321
        )

    [Foto] => Array
        (
            [320] => Array
                (
                    [p_description] => galleria 2
                    [g_tag] => sub1
                    [p_cu] => Q0GREI
                )

            [321] => Array
                (
                    [p_description] => galleria 2
                    [g_tag] => sub1
                    [p_cu] => Q0GREI
                )

            [322] => Array
                (
                    [p_description] => galleria 2
                    [g_tag] => sub1
                    [p_cu] => Q0GREI
                )

            [323] => Array
                (
                    [p_description] => galleria 2
                    [g_tag] => sub1
                    [p_cu] => Q0GREI
                )

        )

    [format] => html
    [Itemid] => 157
    [option] => com_chronoconnectivity6
    [view] => connection
)
Array
(
    [switch20] => Array
        (
            [finished] => 1
            [var] => 
        )

)



And Now?
healyhatman 19 Feb, 2020
You should be able to sort yourself out from here surely? Everything looks to be there. gcb is your selections, select54 is your dropdown (PLEASE name it something else). Your switch data source is "{data:various_events}" but you haven't actually named your dropdown that.
ieraora 19 Feb, 2020
Sorry, I try without success.
I think switch isn't correct, but I don't know the way.
{data:various_events} take name of dropdown, is correct?

I tried the Values setup of switch in this way

{var.various_events:publish_selected}={fn:publish_articles_group}
{var.various_events:unpublish_selected}={error:saving the article failed.}
healyhatman 19 Feb, 2020
{data:various_events} is wrong, because you don't HAVE any data called "various_events". Your dropdown is currently called select54.

Those value setups are very wrong. Should just be
publish_selected:{fn:publish_articles_group}
whatever_the_other_possible_value_of_the_dropdown_is:{fn:other_function_you_want_to_call}

And make sure you're actually calling the switch in your submission event with {fn:name_of_your_switch_function}
ieraora 19 Feb, 2020
Answer
Ok. DONE!!!!
Thank You healyhatman for your help.
{data:various_events} vas correct, and there are some other corrections to make.
Here Below all the correct screenshot, for help friends with same question.

Dropdown to events image 22
Dropdown to events image 23

Dropdown to events image 24


Dropdown to events image 25


Dropdown to events image 26

Dropdown to events image 27
Dropdown to events image 28

Dropdown to events image 29
This topic is locked and no more replies can be posted.