Search Results

Search found 84 results on 4 pages for 'radiobuttons'.

Page 1/4 | 1 2 3 4  | Next Page >

  • Why doesn't $("#RadioButtons:checked").val() work in IE?

    - by Randy Heaps
    Why doesn't $("#RadioButtons:checked").val() - id selector - work in Internet Explorer but $("input:radio[name='RadioButtons']:checked").val() - name selector - does? <input name="RadioButtons" id="RadioButtons" type="radio" value="1" checked> <input name="RadioButtons" id="RadioButtons" type="radio" value="2"> <script> alert($("#RadioButtons:checked").val()); alert($("input:radio[name='RadioButtons']:checked").val()); </script>

    Read the article

  • How to make RadioButtons Mutually excusive

    - by Gaddigesh
    I have 7 RadioButtons on a Form 3 of them belongs one group and 4 of them to other group I want the RadioButtons to be mutually exclusive within the group. This can be achieved by putting them in two GroupBoxes, Is there any way we can achieve this without putting them in a container like groupbox

    Read the article

  • Grouping Windows Forms Radiobuttons with different parent controls in C#

    - by Jerry
    Hi, I've got a Windows Forms application in which I have a number of RadioButtons. These RadioButtons are placed within a FlowLayoutPanel which automatically arranges them for me. All RadioButtons that are directly added to the FlowLayoutPanel are grouped, meaning I can select only one of them. However, some of these RadioButtons are paired up with a TextBox so I can supply some argument there. But to have all this arranged properly, I add a Panel control to the FlowLayoutPanel so I can control the alignment of the RadioButton and TextBox relatively to each other myself. These RadioButtons now have their own respective Panels as parent controls and thus are no longer included in the radio group with the other RadioButtons. I read that the the RadioButtons that are in the System.Web.UI namespace have a GroupName property, but unfortunately their System.Windows.Forms counterparts lack this property. Is there some other way I can group these radio buttons are am I going to have to handle onClick events myself? Thanks, Jerry

    Read the article

  • RadioButtons and Lambda Expressions

    - by MightyZot
    Radio buttons operate in groups. They are used to present mutually exclusive lists of options. Since I started programming in Windows 20 years ago, I have always been frustrated about how they are implemented. To make them operate as a group, you put your radio buttons in a group box. Conversely, to group radio buttons in HTML, you simply give them all the same name. Radio buttons with the same name or ID in HTML operate as one mutually exclusive group of options. In C#, all your radio buttons must have unique names and you use group boxes to group them. I’m in the process of converting some old code to C# and I’m tasked with creating a user control with groups of radio buttons on it. I started out writing the traditional switch…case statements to check the appropriate radio button based upon value, loops to uncheck them all, etc. Then it occurred to me that I could stick the radio buttons in a Dictionary or List and use Lambda expressions to make my code a lot more maintainable. So, here is what I ended up with: Here is a dictionary that contains my list of radio buttons and their values. I used their values as the keys, so that I can select them by value. Now, instead of using loops and switch…case statements to control the radio buttons, I use the lambda syntax and extension methods. Selecting a Radio Button by Value This code is inside of a property accessor, so “value” represents the value passed into the property accessor. The “First” extension method uses the delegate represented by the lambda expression to select the radio button (actually KeyValuePair) that represents the passed in value. Finally, the resulting checkbox is checked. Since the radio buttons are in the same group, they function as a group, the appropriate radio button is selected while the others are unselected. Reading the Value This is the get accessor for the property that returns the value of the checked radio button. Now, if you’re using binding, this code is likely not necessary; however, I didn’t want to use binding in this case, so I think this is a good alternative to the traditional loops and switch…case statements.

    Read the article

  • WPF: How to bind RadioButtons to an enum?

    - by Sam
    I've got an enum like this: public enum MyLovelyEnum { FirstSelection, TheOtherSelection, YetAnotherOne }; I got a property in my DataContext: public MyLovelyEnum VeryLovelyEnum { get; set; } And I got three RadioButtons in my WPF client. <RadioButton Margin="3">First Selection</RadioButton> <RadioButton Margin="3">The Other Selection</RadioButton> <RadioButton Margin="3">Yet Another one</RadioButton> Now how do I bind the RadioButtons to the property for proper two-way-binding?

    Read the article

  • PyGTK: Radiobuttons are still displayed after removal

    - by canavanin
    Hi everyone! I am using PyGTK and the gtk.assistant. On one page I would like to display two radiobuttons in case the user selected a certain option on a previous page. The labels of the buttons - and whether the buttons are to be present at all - are to depend entirely on that earlier selection. Furthermore, if the user goes back and changes that selection, the page containing the radiobuttons is to be updated accordingly. I have got as far as having the radiobuttons displayed when necessary, and with the correct labels. The trouble is that if I go back and change the determining selection, or if I move one page further than the 'radiobutton page' and then move back, the buttons are not only not removed (in case that would have been required), their number has also doubled. To show you what I'm doing, here's part of my code (I've left out bits that do unrelated things, that's why the function name doesn't fit). The function is called when the "prepare" signal is emitted prior to construction of the 'radiobutten page'. def make_class_skills_treestore(self): print self.trained_by_default_hbox.get_children() # PRINT 1 for child in self.trained_by_default_hbox.get_children(): if type(child) == gtk.RadioButton: self.trained_by_default_hbox.remove(child) #child.destroy() # <-- removed the labels, but not the buttons print self.trained_by_default_hbox.get_children() # PRINT 2 class_skills = self.data.data['classes'][selected_class].class_skills.values() default_trained_count = (class_skills.count([True, True]) , class_skills.count([True, False])) num_default_trained_skills = default_trained_count[1] / 2 # you have to pick one of a pair --> don't # count each as trained by default for i in range(default_trained_count[0]): # those are trained by default --> no choice num_default_trained_skills +=1 selected_class = self.get_classes_key_from_class_selection() if default_trained_count[1]: for skill in self.data.data['classes'][selected_class].class_skills.keys(): if self.data.data['classes'][selected_class].class_skills[skill] == [ True, False ] and not self.default_radio: self.default_radio.append(gtk.RadioButton(group=None, label=skill)) elif self.data.data['classes'][selected_class].class_skills[skill] == [ True, False ] and self.default_radio: self.default_radio.append(gtk.RadioButton(group=self.default_radio[0], label=skill)) if self.default_radio: for radio in self.default_radio: self.trained_by_default_hbox.add(radio) self.trained_by_default_hbox.show_all() self.trained_by_default_hbox and self.trained_by_default_label, as well as self.default_radio stem from the above function's class. I have two print statements (PRINT 1 and PRINT 2) in there for debugging. Here's what they give me: PRINT 1: [<gtk.Label object at 0x8fc4c84 (GtkLabel at 0x90a2f20)>, <gtk.RadioButton object at 0x8fc4d4c (GtkRadioButton at 0x90e4018)>, <gtk.RadioButton object at 0x8fc4cac (GtkRadioButton at 0x90ceec0)>] PRINT 2: [<gtk.Label object at 0x8fc4c84 (GtkLabel at 0x90a2f20)>] So the buttons have indeed been removed, yet they still show up on the page. I know the code requires some refactoring, but first I'd like to get it to work at all... If someone could help me out that would be great! Thanks a lot in advance for your replies - any kind of help is highly appreciated.

    Read the article

  • Get the checked value of 2 sets of radiobuttons using jQuery

    - by Hans Wassink
    Im having a weird issue here. Its probably just something stupid but I dont see it. I have two sets of radiobuttons, group1 and group2, and I want to get their values in a function. I have 1 clickevent on all radiobuttons in that div and when I click them I want to display the check-values of both groups. But he only reads the value of the first group. and so it always displays 1-1 2-2 3-3 4-4 instead of possibly 1-2 3-1 etc.... There is a jsfiddle here what am I missing??

    Read the article

  • Get Checked RadioButtons using JavaScript

    - by Rudi
    so I’m trying to build a win 8 app, which includes a WebView. The WebView contains the HTML code (+JavaScript) below. <!DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' > <script type='text/javascript'> function get_radio_value() { for (var i=0; i < document.myForm.frage1.length; i++) { if (document.orderform.frage1[i].checked) { var rad_val = document.myForm.frage1[i].value; return rad_val; } } } </script> <title>Kundenfragebogen</title> </head> <body> <h1>Kundenfragebogen</h1> <div id='myDiv'>Hello</div> <form name='myForm' action=''> <table border='2'> <tr> <td></td> <td>sehr gut</td> <td>gut</td> <td>schlecht</td> </tr> <tr> <td>Wie geht es Ihnen?</td> <td><input type='radio' name="frage1" value='1'/>Mir ging es noch nie besser!</td> <td><input type='radio' name="frage1" value='2'/>Es geht mir so wie immer.</td> <td><input type='radio' name="frage1" value='3'/>Heute geht einfach gar nichts…</td> </tr> <tr> <td>Können Sie Auto fahren?</td> <td><input type='radio' name="frage2" value='1'/>Ja</td> <td></td> <td><input type='radio' name="frage2" value='3'/>Nein</td> </tr> <tr> <td>Möchten Sie unseren Newsletter abonnieren?</td> <td><input type='radio' name="frage3" value='1'/>Ja</td> <td></td> <td></td> </tr> </table> <input type='button' value='Formular absenden' onclick="return get_radio_value()"/> </form> </body> </html> So the html contains some radio buttons and a button. I’ve used JavaScript ~2 years ago (just a little), so I don’t really know how to write the exact code. I’ve found something on the internet, but it doesn’t do what I want. I want to have the following: The user can check the RadioButtons. When the user clicks the Button, the JavaScript function should return all the checked radio buttons (I only need to know which RadioButton is checked). Since I know the name of the RadioButtons in my Windows 8 App, I can do the following: var object = WebView.InvokeScript("JavaScriptFunctionNAME", NameOfRadiobutton); So the WebView invokes the script and should get as a return the VALUE of the RadioButton, which is checked. “JavaScriptFunctionNAME” = name of the function in Javascript NameOfRadiobutton = the name of the RadioButton as a parameter (for example “frage1”). Currently I’m returning the value of the radiobutton, which is checked in the RadioGroup “frage1”. How can I check every RadioButton by it’s parameter? By this I mean I have a parameter “frage1” and return the value of the checked RadioButton. After this, I call the function again with the parameter “frage2” and return the checked RadioButtons value. Could anyone help me out with the JavaScript-function?

    Read the article

  • which type is best for three radiobuttons?

    - by Manog
    Maybe you consider this question trivial but im just curious what is your opinion. I have three radiobuttons. "Show blue", "Show red" and "Show all". I did it with nullable boolean. There is collumn in database where blue is 0 and red is 1 so in metode i have to translate bool to int to compare those values (i do it in c#).Of course it works, but i wonder if it is the best solution. And question is wich type is best in this case? nullable bool, int, or maybe string?

    Read the article

  • Radiobuttons and jQuery

    - by SnowJim
    Hi, I have the following radiobuttons rendered in MVC : <div class="radio" id="ModelViewAd.TypeOfAd"> <input checked="checked" id="ModelViewAd.TypeOfAd_Ad" name="ModelViewAd.TypeOfAd.SelectedValue" type="radio" value="Ad" /> <label for="ModelViewAd.TypeOfAd_Ad">Annons</label><br> <input id="ModelViewAd.TypeOfAd_Auktion" name="ModelViewAd.TypeOfAd.SelectedValue" type="radio" value="Auktion" /> <label for="ModelViewAd.TypeOfAd_Auktion">Auktion</label><br> </div> Now I need to hide the id=divEndDate element based on the value on the radiogroup. I have tried this : $(document).ready(function () { $("#TypeOfAd_Auktion").click(function () { if ($(this).checked) { $("divEndDate").css("visibility", "visible"); } else { $("divEndDate").css("visibility", "hidden"); } }); $("#ModelViewAd.TypeOfAd_Ad").click(function () { if ($(this).checked) { $("divEndDate").css("visibility", "hidden"); } else { $("divEndDate").css("visibility", "visible"); } }); }); Now one of these are triggered when switching between the radio buttons? How to solve this?

    Read the article

  • Creating a column of RadioButtons in Adobe Flex

    - by adnan
    I am having an un-predictable behavior of creating radio buttons in advancedDataGrid column using itemRenderer. Similar kind of problem has been reported at http://stackoverflow.com/questions/112036/creating-a-column-of-radiobuttons-in-adobe-flex. I tried to use the same procedure i.e. bind every radio button selectedValue and value attributes with the property specified in the property of the associated bean but still facing the problem. The button change values! The selected button becomes deselected, and unselected ones become selected. Here is the code of my advancedDataGrid: <mx:AdvancedDataGrid id="adDataGrid_rptdata" width="100%" height="100%" dragEnabled="false" sortableColumns="false" treeColumn="{action}" liveScrolling="false" displayItemsExpanded="true" > <mx:dataProvider> <mx:HierarchicalData source="{this.competenceCollection}" childrenField="competenceCriteria"/> </mx:dataProvider> <mx:columns> <mx:AdvancedDataGridColumn headerText="" id="action" dataField="criteriaName" /> <mx:AdvancedDataGridColumn headerText="Periode 1" dataField="" width="200"> <mx:itemRenderer> <mx:Component> <mx:HBox horizontalAlign="center" width="100%" verticalAlign="middle"> <mx:RadioButton name="period1" value="{data}" selected="{data.period1}" group="{data.radioBtnGrpArray[0]}" visible="{data.showRadioButton}" /> </mx:HBox> </mx:Component> </mx:itemRenderer> </mx:AdvancedDataGridColumn> <mx:AdvancedDataGridColumn headerText="Periode 2" dataField="" width="200"> <mx:itemRenderer> <mx:Component> <mx:HBox horizontalAlign="center" width="100%" verticalAlign="middle"> <mx:RadioButton name="period2" value="{data}" selected="{data.period2}" group="{data.radioBtnGrpArray[1]}" visible="{data.showRadioButton}" /> </mx:HBox> </mx:Component> </mx:itemRenderer> </mx:AdvancedDataGridColumn> <mx:AdvancedDataGridColumn headerText="Periode 3" dataField="" width="200"> <mx:itemRenderer> <mx:Component> <mx:HBox horizontalAlign="center" width="100%" verticalAlign="middle"> <mx:RadioButton name="period3" value="{data}" selected="{data.period3}" group="{data.radioBtnGrpArray[2]}" visible="{data.showRadioButton}" /> </mx:HBox> </mx:Component> </mx:itemRenderer> </mx:AdvancedDataGridColumn> </mx:columns> </mx:AdvancedDataGrid> Any work around is highly appreciated in this regard!

    Read the article

  • I can''t figure out how to use the comboBox to remove radiobuttons

    - by user3576336
    import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.ButtonGroup; import javax.swing.JLabel; import javax.swing.JDesktopPane; import javax.swing.JRadioButton; import javax.swing.JComboBox; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @SuppressWarnings("serial") public class Calendar1 extends JFrame implements ActionListener { private JPanel contentPane; String[] Months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; JDesktopPane desktopPane; ButtonGroup bG = new ButtonGroup(); JRadioButton radioButton, rdbtnNewRadioButton, radioButton_1, radioButton_2, radioButton_3, radioButton_4, radioButton_5, radioButton_6, radioButton_7, radioButton_8, radioButton_9, radioButton_10, radioButton_11, radioButton_12, radioButton_13, radioButton_14, radioButton_15, radioButton_16, radioButton_17, radioButton_18, radioButton_19, radioButton_20, radioButton_21, radioButton_22, radioButton_23, radioButton_24, radioButton_25, radioButton_26, radioButton_27, radioButton_28, radioButton_29; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Calendar1 frame = new Calendar1(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ @SuppressWarnings("unchecked") public Calendar1() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 521, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JComboBox comboBox = new JComboBox(Months); comboBox.setBounds(28, 16, 132, 27); contentPane.add(comboBox); comboBox.setSelectedIndex(0); comboBox.addActionListener(this); JLabel label = new JLabel("2014"); label.setBounds(350, 20, 61, 16); contentPane.add(label); desktopPane = new JDesktopPane(); desktopPane.setBackground(new Color(30, 144, 255)); desktopPane.setBounds(0, 63, 495, 188); contentPane.add(desktopPane); GridBagLayout gbl_desktopPane = new GridBagLayout(); gbl_desktopPane.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_desktopPane.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_desktopPane.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_desktopPane.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; desktopPane.setLayout(gbl_desktopPane); // JLabel lblSun = new JLabel("Sun"); // lblSun.setForeground(Color.RED); // // GridBagConstraints gbc_lblSun = new GridBagConstraints(); // gbc_lblSun.insets = new Insets(0, 0, 5, 5); // gbc_lblSun.gridx = 2; // gbc_lblSun.gridy = 0; // desktopPane.add(lblSun, gbc_lblSun); // // JLabel lblMon = new JLabel("Mon"); // GridBagConstraints gbc_lblMon = new GridBagConstraints(); // gbc_lblMon.insets = new Insets(0, 0, 5, 5); // gbc_lblMon.gridx = 4; // gbc_lblMon.gridy = 0; // desktopPane.add(lblMon, gbc_lblMon); // // JLabel lblTues = new JLabel("Tues"); // GridBagConstraints gbc_lblTues = new GridBagConstraints(); // gbc_lblTues.insets = new Insets(0, 0, 5, 5); // gbc_lblTues.gridx = 6; // gbc_lblTues.gridy = 0; // desktopPane.add(lblTues, gbc_lblTues); // // JLabel lblWed = new JLabel("Wed"); // GridBagConstraints gbc_lblWed = new GridBagConstraints(); // gbc_lblWed.insets = new Insets(0, 0, 5, 5); // gbc_lblWed.gridx = 8; // gbc_lblWed.gridy = 0; // desktopPane.add(lblWed, gbc_lblWed); // // JLabel lblThurs = new JLabel("Thurs"); // GridBagConstraints gbc_lblThurs = new GridBagConstraints(); // gbc_lblThurs.insets = new Insets(0, 0, 5, 5); // gbc_lblThurs.gridx = 10; // gbc_lblThurs.gridy = 0; // desktopPane.add(lblThurs, gbc_lblThurs); // // JLabel lblFri = new JLabel("Friday"); // GridBagConstraints gbc_lblFri = new GridBagConstraints(); // gbc_lblFri.insets = new Insets(0, 0, 5, 5); // gbc_lblFri.gridx = 12; // gbc_lblFri.gridy = 0; // desktopPane.add(lblFri, gbc_lblFri); // // JLabel lblSat = new JLabel("Sat"); // lblSat.setForeground(Color.RED); // GridBagConstraints gbc_lblSat = new GridBagConstraints(); // gbc_lblSat.insets = new Insets(0, 0, 5, 5); // gbc_lblSat.gridx = 14; // gbc_lblSat.gridy = 0; // desktopPane.add(lblSat, gbc_lblSat); radioButton = new JRadioButton("1"); GridBagConstraints gbc_radioButton = new GridBagConstraints(); gbc_radioButton.insets = new Insets(0, 0, 5, 5); gbc_radioButton.gridx = 8; gbc_radioButton.gridy = 1; desktopPane.add(radioButton, gbc_radioButton); bG.add(radioButton); rdbtnNewRadioButton = new JRadioButton("2"); GridBagConstraints gbc_rdbtnNewRadioButton = new GridBagConstraints(); gbc_rdbtnNewRadioButton.insets = new Insets(0, 0, 5, 5); gbc_rdbtnNewRadioButton.gridx = 10; gbc_rdbtnNewRadioButton.gridy = 1; desktopPane.add(rdbtnNewRadioButton, gbc_rdbtnNewRadioButton); bG.add(rdbtnNewRadioButton); radioButton_1 = new JRadioButton("3"); GridBagConstraints gbc_radioButton_1 = new GridBagConstraints(); gbc_radioButton_1.insets = new Insets(0, 0, 5, 5); gbc_radioButton_1.gridx = 12; gbc_radioButton_1.gridy = 1; desktopPane.add(radioButton_1, gbc_radioButton_1); bG.add(radioButton_1); radioButton_2 = new JRadioButton("4"); GridBagConstraints gbc_radioButton_2 = new GridBagConstraints(); gbc_radioButton_2.insets = new Insets(0, 0, 5, 5); gbc_radioButton_2.gridx = 14; gbc_radioButton_2.gridy = 1; desktopPane.add(radioButton_2, gbc_radioButton_2); bG.add(radioButton_2); radioButton_3 = new JRadioButton("5"); GridBagConstraints gbc_radioButton_3 = new GridBagConstraints(); gbc_radioButton_3.insets = new Insets(0, 0, 5, 5); gbc_radioButton_3.gridx = 2; gbc_radioButton_3.gridy = 2; desktopPane.add(radioButton_3, gbc_radioButton_3); bG.add(radioButton_3); radioButton_4 = new JRadioButton("6"); GridBagConstraints gbc_radioButton_4 = new GridBagConstraints(); gbc_radioButton_4.insets = new Insets(0, 0, 5, 5); gbc_radioButton_4.gridx = 4; gbc_radioButton_4.gridy = 2; desktopPane.add(radioButton_4, gbc_radioButton_4); bG.add(radioButton_4); radioButton_5 = new JRadioButton("7"); GridBagConstraints gbc_radioButton_5 = new GridBagConstraints(); gbc_radioButton_5.insets = new Insets(0, 0, 5, 5); gbc_radioButton_5.gridx = 6; gbc_radioButton_5.gridy = 2; desktopPane.add(radioButton_5, gbc_radioButton_5); bG.add(radioButton_5); radioButton_6 = new JRadioButton("8"); GridBagConstraints gbc_radioButton_6 = new GridBagConstraints(); gbc_radioButton_6.insets = new Insets(0, 0, 5, 5); gbc_radioButton_6.gridx = 8; gbc_radioButton_6.gridy = 2; desktopPane.add(radioButton_6, gbc_radioButton_6); bG.add(radioButton_6); radioButton_7 = new JRadioButton("9"); GridBagConstraints gbc_radioButton_7 = new GridBagConstraints(); gbc_radioButton_7.insets = new Insets(0, 0, 5, 5); gbc_radioButton_7.gridx = 10; gbc_radioButton_7.gridy = 2; desktopPane.add(radioButton_7, gbc_radioButton_7); bG.add(radioButton_7); radioButton_8 = new JRadioButton("10"); GridBagConstraints gbc_radioButton_8 = new GridBagConstraints(); gbc_radioButton_8.insets = new Insets(0, 0, 5, 5); gbc_radioButton_8.gridx = 12; gbc_radioButton_8.gridy = 2; desktopPane.add(radioButton_8, gbc_radioButton_8); bG.add(radioButton_8); radioButton_9 = new JRadioButton("11"); GridBagConstraints gbc_radioButton_9 = new GridBagConstraints(); gbc_radioButton_9.insets = new Insets(0, 0, 5, 5); gbc_radioButton_9.gridx = 14; gbc_radioButton_9.gridy = 2; desktopPane.add(radioButton_9, gbc_radioButton_9); bG.add(radioButton_9); radioButton_10 = new JRadioButton("12"); GridBagConstraints gbc_radioButton_10 = new GridBagConstraints(); gbc_radioButton_10.insets = new Insets(0, 0, 5, 5); gbc_radioButton_10.gridx = 2; gbc_radioButton_10.gridy = 3; desktopPane.add(radioButton_10, gbc_radioButton_10); bG.add(radioButton_10); radioButton_11 = new JRadioButton("13"); GridBagConstraints gbc_radioButton_11 = new GridBagConstraints(); gbc_radioButton_11.insets = new Insets(0, 0, 5, 5); gbc_radioButton_11.gridx = 4; gbc_radioButton_11.gridy = 3; desktopPane.add(radioButton_11, gbc_radioButton_11); bG.add(radioButton_11); radioButton_12 = new JRadioButton("14"); GridBagConstraints gbc_radioButton_12 = new GridBagConstraints(); gbc_radioButton_12.insets = new Insets(0, 0, 5, 5); gbc_radioButton_12.gridx = 6; gbc_radioButton_12.gridy = 3; desktopPane.add(radioButton_12, gbc_radioButton_12); bG.add(radioButton_12); radioButton_13 = new JRadioButton("15"); GridBagConstraints gbc_radioButton_13 = new GridBagConstraints(); gbc_radioButton_13.insets = new Insets(0, 0, 5, 5); gbc_radioButton_13.gridx = 8; gbc_radioButton_13.gridy = 3; desktopPane.add(radioButton_13, gbc_radioButton_13); bG.add(radioButton_13); radioButton_14 = new JRadioButton("16"); GridBagConstraints gbc_radioButton_14 = new GridBagConstraints(); gbc_radioButton_14.insets = new Insets(0, 0, 5, 5); gbc_radioButton_14.gridx = 10; gbc_radioButton_14.gridy = 3; desktopPane.add(radioButton_14, gbc_radioButton_14); bG.add(radioButton_14); radioButton_15 = new JRadioButton("17"); GridBagConstraints gbc_radioButton_15 = new GridBagConstraints(); gbc_radioButton_15.insets = new Insets(0, 0, 5, 5); gbc_radioButton_15.gridx = 12; gbc_radioButton_15.gridy = 3; desktopPane.add(radioButton_15, gbc_radioButton_15); bG.add(radioButton_15); radioButton_16 = new JRadioButton("18"); GridBagConstraints gbc_radioButton_16 = new GridBagConstraints(); gbc_radioButton_16.insets = new Insets(0, 0, 5, 5); gbc_radioButton_16.gridx = 14; gbc_radioButton_16.gridy = 3; desktopPane.add(radioButton_16, gbc_radioButton_16); bG.add(radioButton_16); radioButton_17 = new JRadioButton("19"); GridBagConstraints gbc_radioButton_17 = new GridBagConstraints(); gbc_radioButton_17.insets = new Insets(0, 0, 5, 5); gbc_radioButton_17.gridx = 2; gbc_radioButton_17.gridy = 4; desktopPane.add(radioButton_17, gbc_radioButton_17); bG.add(radioButton_17); radioButton_18 = new JRadioButton("20"); GridBagConstraints gbc_radioButton_18 = new GridBagConstraints(); gbc_radioButton_18.insets = new Insets(0, 0, 5, 5); gbc_radioButton_18.gridx = 4; gbc_radioButton_18.gridy = 4; desktopPane.add(radioButton_18, gbc_radioButton_18); bG.add(radioButton_18); radioButton_19 = new JRadioButton("21"); GridBagConstraints gbc_radioButton_19 = new GridBagConstraints(); gbc_radioButton_19.insets = new Insets(0, 0, 5, 5); gbc_radioButton_19.gridx = 6; gbc_radioButton_19.gridy = 4; desktopPane.add(radioButton_19, gbc_radioButton_19); bG.add(radioButton_19); radioButton_20 = new JRadioButton("22"); GridBagConstraints gbc_radioButton_20 = new GridBagConstraints(); gbc_radioButton_20.insets = new Insets(0, 0, 5, 5); gbc_radioButton_20.gridx = 8; gbc_radioButton_20.gridy = 4; desktopPane.add(radioButton_20, gbc_radioButton_20); bG.add(radioButton_20); radioButton_21 = new JRadioButton("23"); GridBagConstraints gbc_radioButton_21 = new GridBagConstraints(); gbc_radioButton_21.insets = new Insets(0, 0, 5, 5); gbc_radioButton_21.gridx = 10; gbc_radioButton_21.gridy = 4; desktopPane.add(radioButton_21, gbc_radioButton_21); bG.add(radioButton_21); radioButton_22 = new JRadioButton("24"); GridBagConstraints gbc_radioButton_22 = new GridBagConstraints(); gbc_radioButton_22.insets = new Insets(0, 0, 5, 5); gbc_radioButton_22.gridx = 12; gbc_radioButton_22.gridy = 4; desktopPane.add(radioButton_22, gbc_radioButton_22); bG.add(radioButton_22); radioButton_23 = new JRadioButton("25"); GridBagConstraints gbc_radioButton_23 = new GridBagConstraints(); gbc_radioButton_23.insets = new Insets(0, 0, 5, 5); gbc_radioButton_23.gridx = 14; gbc_radioButton_23.gridy = 4; desktopPane.add(radioButton_23, gbc_radioButton_23); bG.add(radioButton_23); radioButton_24 = new JRadioButton("26"); GridBagConstraints gbc_radioButton_24 = new GridBagConstraints(); gbc_radioButton_24.insets = new Insets(0, 0, 5, 5); gbc_radioButton_24.gridx = 2; gbc_radioButton_24.gridy = 5; desktopPane.add(radioButton_24, gbc_radioButton_24); bG.add(radioButton_24); radioButton_25 = new JRadioButton("27"); GridBagConstraints gbc_radioButton_25 = new GridBagConstraints(); gbc_radioButton_25.insets = new Insets(0, 0, 5, 5); gbc_radioButton_25.gridx = 4; gbc_radioButton_25.gridy = 5; desktopPane.add(radioButton_25, gbc_radioButton_25); bG.add(radioButton_25); radioButton_26 = new JRadioButton("28"); GridBagConstraints gbc_radioButton_26 = new GridBagConstraints(); gbc_radioButton_26.insets = new Insets(0, 0, 5, 5); gbc_radioButton_26.gridx = 6; gbc_radioButton_26.gridy = 5; desktopPane.add(radioButton_26, gbc_radioButton_26); bG.add(radioButton_26); radioButton_27 = new JRadioButton("29"); GridBagConstraints gbc_radioButton_27 = new GridBagConstraints(); gbc_radioButton_27.insets = new Insets(0, 0, 5, 5); gbc_radioButton_27.gridx = 8; gbc_radioButton_27.gridy = 5; desktopPane.add(radioButton_27, gbc_radioButton_27); bG.add(radioButton_27); radioButton_28 = new JRadioButton("30"); GridBagConstraints gbc_radioButton_28 = new GridBagConstraints(); gbc_radioButton_28.insets = new Insets(0, 0, 5, 5); gbc_radioButton_28.gridx = 10; gbc_radioButton_28.gridy = 5; desktopPane.add(radioButton_28, gbc_radioButton_28); bG.add(radioButton_28); radioButton_29 = new JRadioButton("31"); GridBagConstraints gbc_radioButton_29 = new GridBagConstraints(); gbc_radioButton_29.insets = new Insets(0, 0, 5, 5); gbc_radioButton_29.gridx = 12; gbc_radioButton_29.gridy = 5; desktopPane.add(radioButton_29, gbc_radioButton_29); bG.add(radioButton_29); } @Override public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox) e.getSource(); String months = (String) cb.getSelectedItem(); if (months.equals("February")) { desktopPane.remove(radioButton_28); desktopPane.revalidate(); } } } I'm trying to use the combobox to remove radiobuttons in the actionperformed, but when I run the program, nothing happens, nor can I enable new buttons in the actionperformed. Thank you so much in advance for helping me out.

    Read the article

  • Django RadioButtons with icons and not label?

    - by Asinox
    Hi guy's , i have an app that have 2 fields: company_name and logo, i'm displaying the companies like radiobutton in my Form from Model, but i want to show the logo company instead of the company label (company name) Any idea ? My forms: class RecargaForm(ModelForm): compania = forms.ModelChoiceField(queryset=Compania.objects.all(), initial=0 ,empty_label='None', widget=forms.RadioSelect()) class Meta: model = Recarga Thanks :)

    Read the article

  • Unselecting RadioButtons in Java Swing

    - by Thomas
    When displaying a group of JRadioButtons, initially none of them is selected (unless you programmatically enforce that). I would like to be able to put buttons back into that state even after the user already selected one, i.e., none of the buttons should be selected. However, using the usual suspects doesn't deliver the required effect: calling 'setSelected(false)' on each button doesn't work. Interestingly, it does work when the buttons are not put into a ButtonGroup - unfortunately, the latter is required for JRadioButtons to be mutually exclusive. Also, using the setSelected(ButtonModel, boolean) - method of javax.swing.ButtonGroup doesn't do what I want. I've put together a small program to demonstrate the effect: two radio buttons and a JButton. Clicking the JButton should unselect the radio buttons so that the window looks exactly as it does when it first pops up. import java.awt.Container; import java.awt.GridLayout; import java.awt.event.*; import javax.swing.*; /** * This class creates two radio buttons and a JButton. Initially, none * of the radio buttons is selected. Clicking on the JButton should * always return the radio buttons into that initial state, i.e., * should disable both radio buttons. */ public class RadioTest implements ActionListener { /* create two radio buttons and a group */ private JRadioButton button1 = new JRadioButton("button1"); private JRadioButton button2 = new JRadioButton("button2"); private ButtonGroup group = new ButtonGroup(); /* clicking this button should unselect both button1 and button2 */ private JButton unselectRadio = new JButton("Unselect radio buttons."); /* In the constructor, set up the group and event listening */ public RadioTest() { /* put the radio buttons in a group so they become mutually * exclusive -- without this, unselecting actually works! */ group.add(button1); group.add(button2); /* listen to clicks on 'unselectRadio' button */ unselectRadio.addActionListener(this); } /* called when 'unselectRadio' is clicked */ public void actionPerformed(ActionEvent e) { /* variant1: disable both buttons directly. * ...doesn't work */ button1.setSelected(false); button2.setSelected(false); /* variant2: disable the selection via the button group. * ...doesn't work either */ group.setSelected(group.getSelection(), false); } /* Test: create a JFrame which displays the two radio buttons and * the unselect-button */ public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); RadioTest test = new RadioTest(); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(3,1)); contentPane.add(test.button1); contentPane.add(test.button2); contentPane.add(test.unselectRadio); frame.setSize(400, 400); frame.setVisible(true); } } Any ideas anyone? Thanks!

    Read the article

  • Selecting radiobuttons populated within asp.net RadioButtonList with jQuery

    - by user194881
    Hello and thanks in advance for the communal help I always find here. I have been tinkering around with what should seem a pretty straight forward task even for a jQuery newb as myself. I have a radiobuttonlist control bound to a collection: <asp:RadioButtonList ID="radBtnLstPackageSelector" runat="server" CssClass="PackageS"> </asp:RadioButtonList> My form does have several other controls of the same type; Now, the challenge is to select and wire up a on Click event for every radiobutton from the radBtnLstPackageSelector. I have tried several approaches such as: var results1 = $(".PackageS").children("input"); var results1 = $(".PackageS").children("input[type=radiobutton"); var results1 = $("table.PackageS > input[type=radiobutton"); with no luck... Your help would be great right now! ~m

    Read the article

  • RadioButton checkedchanged event firing multiple times

    - by kash3
    Hi, I am trying to add multiple radiobutton columns to my gridview dynamically in the code and i want to implement some logic which involves database fetch in the checkedchanged event of radiobuttons but some how the checked changed event is being fired multiple times for each row. Following is the code: aspx: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" BorderStyle="None" EnableViewState="true" BorderWidth="1px" CellPadding="4" Font-Names="Verdana"> <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" /> <Columns> <asp:TemplateField HeaderText="Select One"> <ItemTemplate> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Select Two"> <ItemTemplate> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:Label ID="lblval" runat="server" Text="!" ForeColor="Red" Visible="false"/> </ItemTemplate> </asp:TemplateField> </Columns> **code behind** void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.DataItem != null) { DataRowView dvRowview = (DataRowView)e.Row.DataItem; int currentRow = GridView1.Rows.Count; RadioButton rdoSelect1 = new RadioButton(); rdoSelect1.GroupName = "Select" + currentRow; rdoSelect1.ID = string.Concat("rdoSelect1", currentRow); rdoSelect1.AutoPostBack = true; rdoSelect1.CheckedChanged += new EventHandler(rdoSelect_CheckedChanged); e.Row.Cells[0].Controls.Add(rdoSelect1); RadioButton rdoSelect2 = new RadioButton(); rdoSelect2.GroupName = "Select" + currentRow; rdoSelect2.ID = string.Concat("rdoSelect2", currentRow); rdoSelect2.AutoPostBack = true; rdoSelect2.CheckedChanged += new EventHandler(rdoSelect_CheckedChanged); e.Row.Cells[1].Controls.Add(rdoSelect2); if (!IsPostBack) { e.Row.Cells[e.Row.Cells.Count - 1].Controls[1].Visible = false; if (e.Row.Cells[0] != null && Convert.ToBoolean(dvRowview["Select1"]) == true) rdoSelect1.Checked = true; else rdoSelect1.Checked = false; if (e.Row.Cells[0] != null && Convert.ToBoolean(dvRowview["Select2"]) == true) rdoSelect2.Checked = true; else rdoSelect2.Checked = false; } } } void rdoSelect_CheckedChanged(object sender, EventArgs e) { RadioButton rdoSelectedOption = (RadioButton)sender; GridViewRow selRow = rdoSelectedOption.NamingContainer as GridViewRow; if (rdoSelectedOption.Checked) selRow.Cells[selRow.Cells.Count - 1].Controls[1].Visible = true; else selRow.Cells[selRow.Cells.Count - 1].Controls[1].Visible = false; } i want the checkedchanged event to fire only once for a group name and row.

    Read the article

  • How do I find the previous/default value of a radio button in JS?

    - by royrules22
    I'm not sure if this is even possible, but I figured I'd ask before clubbing togehter an ugly solution. What I have is a group of radio buttons and I want to trigger a function if the radio button value is changed. For example say there are three buttons X Y and Z with Y default selected. If a user clicks on an unselected button (i.e. X or Z) then the function gets triggered but if he/she clicks on Y (which is already selected) nothing happens. Naturally the best solution would be to fire the function on an onchange event but IE6 doesn't fire onchange until the focus is no longer on the element which is not satisfactory. So is there a way to know what the previous value of the radio button was or at least what its default value is? I could easily create an array of default values and check against that but I'm trying to reduce the overhead. Please no jQuery suggestions ;)

    Read the article

  • ASP.NET MVC2 : How to use radiobuttons in a grid ?

    - by Stef
    Again a question about RadioButtons/ RadionButtonList I've the following Model: public class **SkillLevelModel** { public long? Id { get; set; } public int? SelectedLevel { get; set;} } I've the following Controller: public class SkillController : BaseController { public ActionResult Index() { var skills = new List<SkillLevelModel>(); for (int i = 0; i < 10; i++) skills.Add(new SkillLevelModel() { Id = i, SelectedLevel = new Random().Next(0,5) }); return View(skills); } I've the following code in the View: <% foreach (var item in Model) { %> <tr> <td style="width: 30px" align="center"> <%= Html.Encode(item.Id) %> </td> <td> <% Html.RenderPartial("UCSkillLevel", item); %> </td> </tr> <% } %> I've the following code in the PartialView: <% for (int i = 0; i <= 5; i++) { %> <td align="center"> <%= Html.RadioButton("SelectedLevel", i, new { id = Model.Id + "_" + i })%> </td> <% } %> The problem is that no radiobutton is checked, althought they have a level. What's wrong here?

    Read the article

  • 2 Mutually exclusive RadioButton "Lists"

    - by user72603
    I think this has to be THE most frustrating thing I've ever done in web forms. Yet one would think it would be the easiest of all things in the world to do. That is this: I need 2 separate lists of radiobuttons on my .aspx page. One set allows a customer to select an option. The other set does also but for a different purpose. But only one set can have a selected radiobutton. Ok I've tried this using 2 asp.net Radiobuttonlists controls on the same page. Got around the nasty bug with GroupName (asp.net assigns the control's uniqueID which prevents the groupname from ever working because now, 2 radiobuttonlists can't have the same groupname for all their radiobuttons because each radiobuttonlist has a different uniqueID thus the bug assigns the unique ID as the name attribute when the buttons are rendered. since the name sets are different, they are not mutually exclusive). Anyway, so I created that custom RadioButtonListcontrol and fixed that groupname problem. But when ended up happening is when I went to put 2 instances of my new custom radiobuttonlist control on my .aspx page, all was swell until I noticed that every time I checked for radiobuttonlist1.SelectedValue or radiobuttonlist2.SelectedValue (did not matter which I was checking) the value always spit back string.empty and i was not able to figure out why (see http://forums.asp.net/t/1401117.aspx). Ok onto the third try tonight and into the break of dawn (no sleep). I tried to instead just scrap trying to use 2 custom radiobuttonlists altogether because of that string.empty issue and try to spit out 2 sets of radiobuttonlists via using 2 asp.net repeaters and a standard input HTML tag inside. Got that working. Ok but the 2 lists still are not mutually exclusive. I can select a value in the first set of radiobuttons from repeater1 and same goes for repeater2. I cannot for the life of me get the "sets" to be mutually exclusive sets of radiobuttons.

    Read the article

  • Arrow keys and changing control's focus hang the application

    - by sthay
    I have a usercontrol that contains a FlowLayoutPanel (topdown flow) with a bunch of radiobuttons. The control exposes a CheckedChanged event that fires whenever one of the radiobuttons's check changed. My form contains the usercontrol and a textbox. I subscribe the usercontrol's CheckedChanged event and depending on which radiobutton gets checked, I either disable the textbox or put a focus inside the textbox. All this works fine with mouseclick when changing the radiobutton's check state. However, this will hang indefinitely when using the arrow keys. I don't understand why the difference. The following are steps to reproduce the behavior I'm seeing: Create a usercontrol and drop a FlowLayoutPanel control and set its FlowDirection = TopDown. Then add two radiobuttons to the FlowLayoutPanel. Provide an event handler in the usercontrol public event EventHandler CheckedChanged { add { radioButton2.CheckedChanged += value; } remove { radioButton2.CheckedChanged -= value; } } Create a windows form and drop the above user control. Add a textbox and set Enabled to False. Subscribe to the usercontrol's CheckedChanged event as follows private void userControl11_CheckedChanged(object sender, EventArgs e) { textBox1.Select(); } Run. Notice that if you use the mouse to click between the radiobuttons, thing works fine; but it will crash if you use the up/down arrow keys.

    Read the article

  • How to update strongly typed Html.DropDownList using Jquery

    - by Remnant
    I have a webpage with two radiobuttons and a dropdownlist as follows: <div class="sectionheader">Course <div class="dropdown"><%=Html.DropDownList("CourseSelection", Model.CourseList, new { @class = "dropdown" })%> </div> <div class="radiobuttons"><label><%=Html.RadioButton("CourseType", "Advanced", false )%> Advanced </label></div> <div class="radiobuttons"><label><%=Html.RadioButton("CourseType", "Beginner", true )%> Beginner </label></div> </div> The dropdownlist is strongly typed and populated with Model.CourseList (NB - on the first page load, 'Beginner' is the default selection and the dropdown shows the beginner course options accordingly) What I want to be able to do is to update the DropDownList based on which radiobutton is selected i.e. if 'Advanced' selected then show one list of course options in dropdown, and if 'Beginner' selected then show another list of courses. The code I would like to call sits within my Controller: public JsonResult UpdateDropDown(string courseType) { IDropDownList dropdownlistRepository = new DropDownListRepository(); IEnumerable<SelectListItem> courseList = dropdownlistRepository.GetCourseList(courseType); return Json(courseList); } Edit - Updated below to show latest position Using examples provided in jQuery in Action, I now have the following jQuery code: $('.radiobuttons input:radio').click(function() { var courseType = $(this).val(); //Get selected courseType from radiobutton var dropdownList = $(".dropdown"); //Ref for dropdownlist $.getJSON("/ByCourse/UpdateDropDown", { courseType: courseType }, function(data) { $(dropdownList).loadSelect(data); }); }); The loadSelect function is taken straight from the book and is as follows: (function($) { $.fn.emptySelect = function() { return this.each(function() { if (this.tagName == 'SELECT') this.options.length = 0; }); } $.fn.loadSelect = function(optionsDataArray) { return this.emptySelect().each(function() { if (this.tagName == 'SELECT') { var selectElement = this; $.each(optionsDataArray, function(index, optionData) { var option = new Option(optionData.Text, optionData.Value); if ($.browser.msie) { selectElement.add(option); } else { selectElement.add(option, null); } }); } }); } })(jQuery); 1 day+ later I still cannot get this to work. Assuming the jQuery code is correct then I can only think that the issue is with retrieving the actual data with $getJSON. I have verified that JsonResult UpdateDropDown does actually retrieve valid data. What am I missing? Assembly reference? (NB: I have MicrosoftAjax.js and MicrosoftMvcAjax.js in my head tags of the master page Should JsonResult be ActionResult? (I have seen both used in samples on web) Do I need to register route Controller/UpdateDropDown in Global.asax? Any further guidance would be appreciated.

    Read the article

1 2 3 4  | Next Page >