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 8293187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:44:29+00:00 2026-06-08T13:44:29+00:00

I would like to create a form in Symfony2 which displays a set of

  • 0

I would like to create a form in Symfony2 which displays a set of radio buttons depending on the selected value in a combo-box belonging to the same form.
I have not been able to find a suitable solution in Symfony2 that would allow me to have this functionality.
Is there any way to use the Symfony2 framework at least for part of the implementation or should I generate the form manually?

  • 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-08T13:44:31+00:00Added an answer on June 8, 2026 at 1:44 pm

    What you’re looking for is AJAX. This can be implemented with straight javascript or jQuery (jQuery is much cleaner and easier to use).

    Here’s a jQuery stub for you to get an idea of what has to happen:

    <script language="javascript">
        $('#mySelect').change(function() {
            $.post('backgroundScript.php', {
                val: $(this).val()
            }, function(data) {
                $('#radioDiv').html(data);
            });
        });
    </script>
    

    If you’re not familiar with AJAX & jQuery, I’ll explain what’s going on. $('#mySelect') is almost the equivalent of javascript’s getElementById() function. They are NOT the same functionality (jQuery uses the same notations as css to find the elements you’re looking for), but this will return the element with mySelect as its id attribute.

    .change() sets the onChange event handler to the function() defined within the brackets. $.post is jQuery shorthand for performing an AJAX post (as opposed to a get), that is sent to backgroundScript.php without a page load. When backgroundScript.php returns with a 200 status (i.e. “everything’s OK, here’s my output”) it will perform the callback function function(data).

    backgroundScript.php will receive val as a $_POST variable and do “something” to determine which radio buttons should be displayed, then will write output to the screen.

    EDIT (more info):

    backgroundScript.php should look something like this if you’re determining the radio buttons based on a database. Keep in mind that this is not written with security or consideration of deprecated functions in mind (e.g. mysql_*), just functionality:

    <?php
    // backgroundScript.php
    $masterVal = $_POST['val'];
    $output = "";
    
    $query = "SELECT bt.button_value, bt.button_label
        FROM button_table as bt
        WHERE bt.button_master_id = " . $masterVal;
    
    $result = mysql_query($query);
    
    while($row = mysql_fetch_array($result)) {
        $output .= "<input type='radio' name='radioGroup' value='" . 
            $row['button_value'] . "' /> " . $row['button_label'];
    }
    
    echo $output;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to set a field to a value selected from a grid
I would like to create a form which has multiple input fields corresponding to
I work with Symfony2 and I would like to create a registration form. I
I would like to create a form where a user can enter an arbitrary
I would like to create an order form for my ASP.net page (I included
I would like to create a data entry form in Drupal 7 that is
i would like create a array of structure which have a dynamic array :
I would like to create set of strings and below is the only limitation.
I would like to create a login form for my application with the possibility
I would like to create an HTML form with one field for user name,

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.