Buy Now
Sign in

Return value dropdown

salvok5 , February 09 2017
Answered
S
salvok5
my problem is to return to a button_link a value taken from the selection in a dropdown.

Button_link:
{url:view_elenco}&gr={fn:ricerca_gruppo}

Views->Fields->Dropdown:
Name: select5[]
ID: select5

Functions : ricerca_gruppo
code : echo $this->select5->value;

by selecting a value on the dropdown list and clicking button_link returns nothing on gr=.
where is the error ?
admin
Hi Salvo,

The dropdown is on the same page ? or a form is sent after the dropdown is selected ?

If a form is sent then you can get any field value using: {data:field_name}

If its on the same page then this will need some code, let me know if this is the case.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
salvok5
as previously explained to, are on view -> Index, with dropdown they select.
Clicking Button_link mi have to open another view
and it must return the link the value of dropdown choice.
This does not work:
{url:view_elenco}&gr={data:select5}
admin
Hi salvo,

Please try to include this code inside a "JS" view and include it in the same page:

$( document ).ready(function() {
$("#dropdown_id").on("change", function(){
$("#button_link_id").attr("href", $("#button_link_id").attr("href") + "&gr=" + $("#dropdown_id").val());
});
});


Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
salvok5
Not work.
admin
Hi salvo,

Did you replace the elements ids with the real ids of your fields in the code ?

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
salvok5
I have made a view JS: richiama_drop

on Content I insert this:
$( document ).ready(function() {
$("#dropdown_id").on("change", function(){
$("#button_link_id").attr("href", $("#button_link_id").attr("href") + "&gr=" + $("#dropdown_id").val());
});
});


or this?
$( document ).ready(function() {
$("#select5").on("change", function(){
$("#Ricerca").attr("href", $("#Ricerca").attr("href") + "&gr=" + $("#select5").val());
});
});


of index event i have included this:
{fn:richiama_valori_tipo}
{fn:richiama_valori_settore}
{view:richiama_drop}
{view:Campi-ricerca}
{debug:}

and Button_link have insert this:
{url:view_elenco}{view:richiama_drop}

But it does not work.

If, please, can you tell me step by step how and where they enter codes.
If I can give you some advice is to write a tutorial DETAILED with ALL the functions that can be use and with MANY examples, only way to use profitably this library.
Thank you
S
salvok5
"admin":
Hi salvo,

Did you replace the elements ids with the real ids of your fields in the code ?

Best regards,
Max

yes.
admin
Hi salvo,

Its the 2nd code which you should use, do you have a link to this page online so I can test this ?

I will try to write more tutorials, but the issue here is custom code, so it can not be included in tutorials.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
admin
ok, please change the first line of the code to this:
jQuery(document).ready(function($){


Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
salvok5
It's WORK.
You are a great MAX
S
salvok5
I'm sorry but there is an error on the code:
If I click on the first choice -> "AVVISO"
then instead change the selection with -> "BANDO" the link is well with 2 &gr=
http://www.comunesortino.gov.it/index.php/component/chronoconnectivity6/?cont=manager&conn=albo-ricerca&event=view_elenco&gr=0&gr=2
S
salvok5
solution found.
admin
Hi Salvo,

Even if the link has 2 values for the same parameter, only the 2nd one will work.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!