首页 \ 问答 \ 检查所有选中的单选按钮是否具有特定值(Check if all radio buttons checked having particular value)

检查所有选中的单选按钮是否具有特定值(Check if all radio buttons checked having particular value)

<input type="radio" checked="checked" value="true" name="child">
<span class="label">Show</span>
<input type="radio" class="hide" value="false" name="child">
<span class="label">Hide</span>

和同一页面上的另一个单选按钮

<input type="radio" checked="checked" value="true" name="baby">
<span class="label">Show</span>
<input type="radio" class="hide" value="false" name="baby">
<span class="label">Hide</span>

我需要知道是否所有使用javascript检查value="false"的单选按钮。

注意:单选按钮名称不同


<input type="radio" checked="checked" value="true" name="child">
<span class="label">Show</span>
<input type="radio" class="hide" value="false" name="child">
<span class="label">Hide</span>

and another radio button on the same page

<input type="radio" checked="checked" value="true" name="baby">
<span class="label">Show</span>
<input type="radio" class="hide" value="false" name="baby">
<span class="label">Hide</span>

I need to know if all the radio buttons having value="false" are checked using javascript.

Note: The radio button names are different


原文:https://stackoverflow.com/questions/6068599
更新时间:2021-12-07 09:12

最满意答案

在Play Framework中有一个与此相关的错误 ,但从讨论看来,这似乎是Java的问题而不是Play本身。 解决方法将是这样的(信用igmar ):

return promiseBool.map(new Function<Boolean, Result>() {
    @Override
    public Result apply(Boolean bool) throws Throwable {
        Result res = ok();
        return res;
    }
}).recover(new Function<Throwable, Result>() {
    // Same
});

使用return (Result) ok(); 也可以工作。


There was a bug related to this in Play Framework but from the discussion it seems that this is more a problem of Java than Play itself. The workaround would be something like this (credit to igmar):

return promiseBool.map(new Function<Boolean, Result>() {
    @Override
    public Result apply(Boolean bool) throws Throwable {
        Result res = ok();
        return res;
    }
}).recover(new Function<Throwable, Result>() {
    // Same
});

Using return (Result) ok(); may also work.

相关问答

更多
  • 您可以使用flatMap解决您的问题,它将为您连接(展平)列表。 def combine( head : (Char,Int), xs : Occurrences) : List[Occurrences] = xs.flatMap { case (x,i) => (1 to head._2).map(occu =>List((x,i), (head._1, occu))) } 现在,对于每次出现,它将生成一个包含(x,i)元组和(head._1, occu)元组的列表,并且所有列表将基本上由flatM ...
  • 尝试将PivotCache和PivotTable PivotCache分割设置为2个单独的代码行,如下面的代码所示: Dim pTbl As PivotTable Dim pCach As PivotCache ' set the Pivot Cache Set pCach = ThisWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=pTRng) ' create a new Pivot Table in "wOPT" s ...
  • 如果你仔细看看Future.recover方法,你会发现部分函数应该有未来类型的子类型,在你的情况下是Int,因为你将recover应用于原始的Future'wourway'。 要修复它,您应该将其应用于映射: future.map { result => { println(2) Ok("Finished OK") } }.recover { case _ => { println(3) Ok("Failed") } } If you take ...
  • AD7six是对的,有些东西在干扰。 我的模型中有一个beforeFind()回调,如下所示: public function beforeFind($queryData){ if ((!isset($queryData['exclude']) || $queryData['exclude']) && (empty($queryData['conditions']['Category.id']) || is_array($queryData['conditions']['Category.id']) ...
  • 在Play Framework中有一个与此相关的错误 ,但从讨论看来,这似乎是Java的问题而不是Play本身。 解决方法将是这样的(信用igmar ): return promiseBool.map(new Function() { @Override public Result apply(Boolean bool) throws Throwable { Result res = ok(); return res; ...
  • 这是因为递归类型。 榆树似乎没有特别直观(对Haskeller来说)处理这些,你必须在那里做一些明确的展开和包装以使它全部工作。 我假设编译器引导您进入您拥有的User类型的定义,就像我开始玩它时一样。 但结果是,示例中User类型的值不是记录,它们是将记录作为参数的数据构造函数。 您必须对这些值进行模式匹配才能获得记录,并且每当返回这样的值时都要记住包含构造函数。 幸运的是,Elm具有良好的模式匹配支持,或者这将是可怕的。 因此,如果您将update功能更改为 update : User -> Ac ...
  • 原因是Scala将df_aud("HASH_TTL")视为udf_cleansing函数的参数,而不是将此函数返回给UDF。 相反,你应该写: def udf_cleansing = udf( (col1 : Double) => { val col2 : String = f"$col1%.5f" if(col2.trim == "" || col2 == null ) 0.toString else col2.substring(0,col2.indexOf(". ...
  • 也许,我别无选择,只能专门化从Base类继承的每种类型。 def encode(input:String, value:Any, m:Map[String, Base[_]]) = { if (input.startsWith("string")) m("string").asInstanceOf[MString].encode(value.asInstanceOf[String]) else if (input.startsWith("int")) m(" ...
  • 直接使用EVALUATE要容易得多 Sheets("1.A").Cells(124, 14) = Evaluate("=MMULT(TRANSPOSE(F124:F370-L124),G124:G370-L125)/246") 或者你的变量 Dim strEval As String matchStartRow = 124 matchEndRow = 370 strEval = "=MMULT(TRANSPOSE(F" & matchStartRow & ":F" & matchEndRow & "-L1 ...
  • 我写了一个宏来测试这个并且日期格式dd.mm.yyyy无效,似乎你必须使用dd/mm/yyyy (使用斜杠而不是句点)或dd-mm-yyyy (使用连字符而不是句点): Sub Macro1() Dim minDate As Date Dim DateStr As String ' with slashes, ok DateStr = "27/12/2013" minDate = CDate(DateStr) ' replace periods w/ s ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)