checkbox

Rails checkbox and params

大兔子大兔子 提交于 2019-12-23 11:44:23
问题 I am using many checkboxes in a page as the following: <%= check_box_tag(:one, value = 1) %></p> Imagine that it goes from 1 to 20, all the same with the value changed. How can I get in the controller the params of the ones that were checked? Example: If user checks 3, 5 and 10 how can I get just those params in a single params? 回答1: You'll already get only the ones that were checked; unchecked boxes aren't sent to the server. 来源: https://stackoverflow.com/questions/7870090/rails-checkbox-and

Dynamically changing a checkbox doesn't trigger onChange?

安稳与你 提交于 2019-12-23 09:38:19
问题 Note: jQuery is not an option. I want to detect a change in the state of a checkbox, but the onChange event doesn't seem to fire when I do this: document.getElementById('myCheckBox').addEventListener('change',function() { console.log('Changed!'); }); document.getElementById('someLink').onClick = function() { // toggle checkbox document.getElementById('myCheckBox').checked = !document.getElementById('myCheckBox').checked; }; When I click #someLink the change event is not fired. I could add

Bootstrap form-horizontal vertical alignment of checkboxes without label text

点点圈 提交于 2019-12-23 07:57:32
问题 I have changed from Bootstrap 3.0.0 to 3.2.0 this morning because I needed some of the new features for my web application. Everything seemed to work as expected until I observed an issue with the vertical alignment of checkboxes in a .form-horizontal form. An example is available at http://www.bootply.com/AYN64feYze. The markup for this minimum example is: <div class="form-horizontal"> <div class="form-group"> <label class="col-sm-2 control-label">With label text</label> <div class="col-sm

How to save checked status for checkbox in data grid view c# windows application

心不动则不痛 提交于 2019-12-23 07:05:00
问题 I am working in c# windows application populate record from sql server to data grid view, with dynamic checkbox facility in each row. i want to select selected rows for some purpose via checkbox of that particular row. till now i successfully achieve my target. but i'm facing a minor issue regarding saving a checked status, Example i want to check only those records whose Name = Max i have a textbox in that textbox i call text chnage event with like Query Code for Filter by name: try {

Insert 0 or 1 into MySQL based on checkbox value

送分小仙女□ 提交于 2019-12-23 06:08:19
问题 I would like to insert the "0" or "1" into mysql database by using php checkbox. However, it is unable to modify or insert on mysql database. My coding edit.php : <?php switch($_GET['action']) { case "Modify": /*************************** case "modify" **********************/ $colname_RsStaff = "1"; if (isset($_GET['staffid'])) { $colname_RsStaff = (get_magic_quotes_gpc()) ? $_GET['staffid'] : addslashes($_GET['staffid']); } mysql_select_db($database_conn, $conn); $query_RsStaff = "SELECT *

javascript, all of a sudden jquery doesn't detect that my checkbox is checked

陌路散爱 提交于 2019-12-23 06:06:18
问题 http://pastebin.com/r30Wfvi3 All of a sudden that just stopped working. var showMyLocation = document.createElement('input'); showMyLocation.type = "checkbox"; showMyLocation.className = "checkboxForRange"; showMyLocation.id = "showMyLocation"; $$.children("#showMyLocation").html('<p style="float:left">Vis min posisjon :</p>').append(showMyLocation); $('#' + showMyLocation.id).change(function () { //location console.log("clicked"); if ($(this).is(":checked")) { console.log("y"); GarageHandler

iTextSharp: reading radio button, check box states from a non-form PDF

梦想与她 提交于 2019-12-23 05:58:55
问题 I have a pdf document (created by a 3rd party using RealObjects PDFreactor), which is not a form . I'm trying to extract information from that PDF using iTextSharp. I'm able to extract all the plain text (using SimpleTextExtractionStrategy ), but there is some information that is represented with radio buttons, which does not come across in the plain text extracted. I'm a complete beginner with iTextSharp, so I might be overlooking something very simple. PdfReader.AcroForm returns null, and

Validating multiple check boxes in PHP. Must check at least one but not more than three checkboxes

空扰寡人 提交于 2019-12-23 05:42:19
问题 I am using PHP to create a voting system and I have a form that I am inserting into MySQL database. I am going to use JavaScript to ensure that the user selects at least one candidate but not more than three, but I want to validate on the server side as well. Here is the web form for the page: <form method="post" action="post.php"> <input type="checkbox" name="vote[FR01]" value="ON"> Freshman Candidate 1 <br /> <input type="checkbox" name="vote[FR02]" value="ON"> Freshman Candidate 2 <br />

How can I get the checked checkbox values using MVVM?

自闭症网瘾萝莉.ら 提交于 2019-12-23 05:37:05
问题 Right now, I'm working on a WPF project. I have a confirmation dialog that displays a list of repeated strings that the user imported from a CSV file. The user can check off the repeated strings they want to add to a list (listview) and click ok. The problem is I'm not sure how to get the value of the checkbox items that are checked off and add them to a list. How do I know what checkbox is selected and add the selected items to a list? I want to do this task using MVVM and not code behind. I

TreeView with CheckBoxes dynamically WPF. How to know the name of the elements selected

笑着哭i 提交于 2019-12-23 04:59:08
问题 I have a code that displays the files and folders names in a TreeView and put a checkbox from each element. What I don't know how to do is how to know the elements in the TreeView that are selected with the checkboxes. XAML: <TreeView Name="treeView" Grid.Row="10" Grid.ColumnSpan="3"> <TreeView.Resources> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="HeaderTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox Focusable="False" IsChecked="False