Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8897673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:24:25+00:00 2026-06-15T00:24:25+00:00

I have a link in symfony2.0 generated with twig’s path function like: <a id=aBtn

  • 0

I have a link in symfony2.0 generated with twig’s path function like:

<a id="aBtn" href="{{ path("SomeController_someControllerAction",{'section_id':
    section_id, 'period_id': period.getId }) }}>A link</a>

And i also have some javascript that updates the “section_id” part of the generated URL every time a user changes a section on the page:

function updateSectionId(id){
  var aBtn = $("#aBtn");
  var href = aBtn.attr('href');
  var splitted = href.split("/");
  splitted[splitted.length-2] = id; //My routing puts the period_id at that position
  //(Yes i know its pretty hardcoded...)
  aBtn.attr('href',splitted.join("/"));
}

I have verified and the link is updated with the corresponding section_id.

However, debugging the action that recieves this request i find out that it always recieves section_id = 1.

public function newQuestionDialogAction($period_id, $section_id){
  //$period_id = 1 ALWAYS, regardless of href value on the link.

I am really clueless… am i missing something on twig’s route generation?

EDIT: Here is route configuration

SomeController_someControllerAction:
    pattern: /{period_id}/section/{section_id}/someControllerAction
    defaults: { _controller: "SomeBundle:SomeController:someControllerAction" }
    requirements:
      _method: GET

EDIT2:
I have a hunch that the origin of this problem is the jquery-bootstrap plugin “Modal 2” used to execute ajax requests to the server. I’ll let you know if i find the problem. thanks!

https://github.com/Nikku/jquery-bootstrap-scripting

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:24:27+00:00Added an answer on June 15, 2026 at 12:24 am

    So the problem was indeed with my javascript, and the solution is embarrassingly simple. I am posting here in case someone stumbles upon the same problem with the jquery bootstrap library.

    Once you call

    $(document).controls()
    

    All the classes “open-dialog” on every element is removed, thus no matter how many times you call $(document).controls() it wont update the onClick event with the correct href. The workaround is to add “open-dialog” class before calling $(document).controls() again.

    $("#some-element").addClass("open-dialog");
    $(document).controls();
    

    So, in my case, the solution was to update my updateSectionId method

    function updateSectionId(id){
      var aBtn = $("#aBtn");
      var href = aBtn.attr('href');
      var splitted = href.split("/");
      splitted[splitted.length-2] = id; //My routing puts the period_id at that position
      //(Yes i know its pretty hardcoded...)
      aBtn.attr('href',splitted.join("/"));
      //Add open-dialog class and call controls to reattach the href
      aBtn.addClass("open-dialog");
      $(document).controls();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have link that calls a function when clicked: <a href=javascript:spawnMenu(this); id=link1>Test1</a> To make
i have link like this <td><a href=<?php echo base_url(); ?>index.php/c_materialjasa/gkategorimaterial>Lihat Tabel</a></td> here is my
I have a delete link in my twig template and I would like to
I have this link in a template: <a href={% url show_item item.id %}>Item 1</a>
I have a link which looks like that: www.domain.com/file.php I want to create .htaccess
i have link like this i need show detail of city in dialog box
I am working on an ASP.NET/C# Application. I have Link buttons like this <asp:LinkButton
I have a controller in symfony2 like below, if the user form is valid
I'm building a site using symfony php framework. I have a link in my
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.