質問

I'm using formhandler extension v1.6.2 and Typo3 v6.1.5.

User must upload a CV or fill in LinkedIn ID. If none of the fields are filled, an error should appear and the form should not be submitted. So, I would like to add typoscript conditions but it doesn't work :

HTML

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

Typoscript

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

Thanks for any help !

役に立ちましたか?

解決

As far as I understand, it should be enough to make the file required if the text field is empty, right? Then try this:

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

BTW: using the predef stuff is much cleaner and safer if you have multiple forms on your site.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top