checkbox

Angular 2 Checkbox preventDefault

这一生的挚爱 提交于 2021-01-27 13:40:29
问题 I am making a Bootstrap checkbox dropdown and the options is wrapped in an <a> tag that handles the click, but I also have a <input type="checkbox"> inside the a-tag. My problem occurs when the user is pressing on the actual checkbox instead of just the <a> element. Both are clicked and some conflict happen. The checkbox checked-state should be inverted but isn't. In Angular1 it worked to just use preventDefault() on the checkbox-click, but in my angular2-test it stops the checkbox from

DevExpress XtraGrid checkbox check not registered unless focus changes

允我心安 提交于 2021-01-27 04:11:12
问题 We have a databound XtraGrid on our Windows form. One of the columns is a check box. The problem is as follows: when users check the checkbox and click OK button, the checkbox, while visibly checked, is not considered checked by the grid. When I do this (while looping through rows): isAllowed = Convert.ToBoolean(viewMain.GetRowCellValue(nRowCtr, "IsAllowed")) I get back False. BUT, if the user checks the box, and then clicks somewhere else on the form or on another row in this grid, thus

Get Closest Form to an Element in jQuery

随声附和 提交于 2021-01-26 20:33:12
问题 I have this js/jquery script i wrote to check all checboxes with in a form. It works well but this checks all checkboxes that are on page irrespective of the form wrapper they are. here is the function function toggleCheck(state) { var checkboxes = jQuery("form input:checkbox"); if(state==true){checkboxes.prop('checked',true); } if(state==false){ checkboxes.prop('checked',false); } } usage <a id="check" href="#" onclick="javascript:toggleCheck(true);" class="btn">Select All</a> <a id="uncheck

Get Closest Form to an Element in jQuery

大兔子大兔子 提交于 2021-01-26 20:32:20
问题 I have this js/jquery script i wrote to check all checboxes with in a form. It works well but this checks all checkboxes that are on page irrespective of the form wrapper they are. here is the function function toggleCheck(state) { var checkboxes = jQuery("form input:checkbox"); if(state==true){checkboxes.prop('checked',true); } if(state==false){ checkboxes.prop('checked',false); } } usage <a id="check" href="#" onclick="javascript:toggleCheck(true);" class="btn">Select All</a> <a id="uncheck

Rails 4: Save Checkbox Results to Serialized Array

十年热恋 提交于 2021-01-26 09:20:50
问题 I have a Campaign model with a channel column. This channel will store a serialized array of chosen results via checkboxes. Here's the model.. app/models/campaign.rb class Campaign < ActiveRecord::Base serialize :channels, Array end app/controllers/compaigns_controller.rb class CampaignsController < ApplicationController def index @campaigns = Campaign.all.order("created_at DESC") end def new @campaign = Campaign.new end def create @campaign = Campaign.new(campaign_params) if @campaign.save

Rails 4: Save Checkbox Results to Serialized Array

坚强是说给别人听的谎言 提交于 2021-01-26 09:17:09
问题 I have a Campaign model with a channel column. This channel will store a serialized array of chosen results via checkboxes. Here's the model.. app/models/campaign.rb class Campaign < ActiveRecord::Base serialize :channels, Array end app/controllers/compaigns_controller.rb class CampaignsController < ApplicationController def index @campaigns = Campaign.all.order("created_at DESC") end def new @campaign = Campaign.new end def create @campaign = Campaign.new(campaign_params) if @campaign.save

Using a checkbox list with Razor Pages for input to DB

有些话、适合烂在心里 提交于 2021-01-24 12:22:29
问题 I want one of my inputs in a form to come from a list of checkboxes that the user selects. I've been going at this for several hours now, and I still don't understand what I need to do for this. Why is there so much help for MVC on this topic and hardly any for Razor? .cshtml <form method="post"> <label asp-for="ServiceRqLd.JobType" class="control-label"></label> <div class="form-check-inline"> @for (var i = 0; i < Model.JobTypes.Count(); i++) { <div class="form-check"> <input asp-for="@Model

Using a checkbox list with Razor Pages for input to DB

落爺英雄遲暮 提交于 2021-01-24 12:22:21
问题 I want one of my inputs in a form to come from a list of checkboxes that the user selects. I've been going at this for several hours now, and I still don't understand what I need to do for this. Why is there so much help for MVC on this topic and hardly any for Razor? .cshtml <form method="post"> <label asp-for="ServiceRqLd.JobType" class="control-label"></label> <div class="form-check-inline"> @for (var i = 0; i < Model.JobTypes.Count(); i++) { <div class="form-check"> <input asp-for="@Model

Javascript limit selected checkboxes to 2

三世轮回 提交于 2021-01-20 12:38:44
问题 I would like to disable selecting more than 2 choice checkboxes, but I couldn't do it with my javascript code. How can I do this? btn.addEventListener("click",function () { var ourRequest = new XMLHttpRequest(); ourRequest.open('GET','questions.json');//json dosyasından sorular ve sıklar okunuyor ourRequest.onload = function () { pos = 0; counters = [A=0,B=0,C=0,D=0]; ourData = JSON.parse(ourRequest.responseText); renderQuestion(ourData); btn.innerHTML = "BAŞA DÖN"; } ourRequest.send(); })

How to render dynamic checkbox conditionally in Reactive forms

和自甴很熟 提交于 2021-01-07 03:22:54
问题 I'm trying to create dynamic checkbox list conditionally on a value select Tried various solution online but unable to get the expected result. Also, Facing issues with binding value to form-control Final result is expected to be a formdata of below format on submit: { name:"new Experiment", depth: 'Exp Wise", durationPerDepth:[{ exp:"exp1", duration:"10mins" ]} } -----OR--- { name:"new Experiment", depth: 'For All", durationPerDepth:[{ exp:"All", duration:"10mins" ]} } for_all[ ] set_for_all