【问题标题】:Typo3 Formhandler : How to validate at least one of two fields in typoscriptTypo3 Formhandler:如何验证打字稿中的两个字段中的至少一个
【发布时间】:2014-01-06 08:58:46
【问题描述】:

我正在使用表单处理程序扩展 v1.6.2 和 Typo3 v6.1.5。

用户必须上传简历或填写 LinkedIn ID。如果没有填写任何字段,则会出现错误并且不应提交表单。 所以,我想添加打字条件,但它不起作用:

HTML

<input type="file" id="file" name="cv[file]">
<input type="text" size="20" id="linkedin" name="cv[linkedin]">

排版

plugin.Tx_Formhandler.settings {
   if {
       1 {
           conditions {
               OR1 {
                   AND1 = file=
                   AND2 = linkedin=
               }
               isTrue {
                   validators.1.config.fieldConf.linkedin.errorCheck.1 = required
               }
          }
       }
   }
}

感谢您的帮助!

【问题讨论】:

    标签: typo3 typoscript


    【解决方案1】:

    据我了解,如果文本字段为空,则应该足以使文件成为必需,对吗?然后试试这个:

    plugin.Tx_Formhandler.settings {
        if {
            1 {
                conditions.OR1.AND1 = linkedin=
                isTrue {
                    validators.1.config.fieldConf.file.errorCheck.1 = fileRequired
                }
            }
        }
    }
    

    顺便说一句:如果您的网站上有多个表单,使用 predef 的东西会更干净、更安全。

    【讨论】:

      猜你喜欢
      • 2011-07-21
      • 2022-12-08
      • 2017-07-05
      • 1970-01-01
      • 2020-08-20
      • 2014-06-17
      • 2013-02-16
      • 1970-01-01
      • 2021-01-31
      相关资源
      最近更新 更多