eZ Community » Forums » Developer » js in template
expandshrink

js in template

js in template

Tuesday 19 February 2013 11:45:35 am - 1 reply

Hi,

I'm on ezpublish, and I have a basic problem :

I have to establish an advanced search.

I have 2 combos box, the first one let you choose a siteaccess,  and the second one should display sub categories of the siteaccess which is selected.

I have a js which redirect and i want to recover the view parameter like -> $view_parameter.mini_site

 

 $("#mini_site").change(function(){
   document.location.href="http://my_website/content/advancedsearch/(mini_site)/"+$(this).val();
});

could you tell me how am i supposed to do to get what i want?

Thanks

 

matthew

Modified on Tuesday 19 February 2013 11:48:23 am by Villalonga Matthieu

Wednesday 20 February 2013 5:07:00 am

Hi,

I'm not sure if this is exactly what you want but I would think you can just call that variable into your js code in the template.

Say like 

{literal}
$("#mini_site").change(function(){
   document.location.href="http://my_website/content/advancedsearch/(mini_site)/{/literal}{$view_parameter.mini_site}{literal}";
});
{/literal}

Another way would be to place the view parameter into a hidden input and then pull the .val() of that input.

I tend to just call the variable directly into the js in situations like that though.

Modified on Wednesday 20 February 2013 5:09:27 am by Daniel Clements

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from