Redirects after click (dynamic menu)

Hi,

I use dynamic dependant drop-down list to realize the menu below.

The table is structured as below:

  • idCategory
  • label
  • idCategoryParent
  • url

idCategoryParent for the first level is 0.

At click, I want the user to be redirected to the page indicated in the column url, only if the selected element has no child elements. Thanks for your support.

Assuming that you have the menu working properly, the URL field will only be populated for the last item in the stream.

The logic is to then show a link for the last item, which can be hidden to show a normal entry when no URL is present.

Thanks for your reply,
Menu is working perfecly. As you can see in these images below , I have already implemented this solution. But I do not want to show / hide the link. I want the redirection to be done as soon as we click on a last item.

@Djibril, unless I do not understand your question (happens often at my age), the logic that I have given will do exactly that.

For the last item you will need an anchor tag which can be clicked for the redirection. By showing and hiding the <a> element, there will be a link if the URL field is populated (last item) and no link if the item is upstream.

You are very modest, rather I think it’s me who did not explain well. If you look at the images above, you will notice at the bottom of some images a link that appears, if the selected element is the last in the stream (this link is outside the “select” tag). With this solution, the user will then have to click on this link to be redirected to the desired page. What I want in fact is that the redirection is done from the previous click (if the element selected is the last in the stream).