[TYPO3-german] Formhandler - ErrorChecks für dynamisch generierte Felder
Johannes C. Laxander
jc at laxander.com
Wed Apr 13 16:17:14 CEST 2016
Hallo,
In einem Formular werden dynamisch über CONTENT-Object Felder generiert. Hier die verkürzte Form:
concerts = CONTENT
concerts {
table = tx_news_domain_model_news
select {
pidInList = 3
orderBy = event_date
selectFields = title,event_date,price_member,price_non_member
where = event_date > ###today### AND sold != '1' AND called_off != '1' AND deleted=0 AND hidden=0
markers {
today.data = date: U
}
}
renderObj = COA
renderObj {
stdWrap.wrap = <div class="form-group row">|</div>
//...
20 = COA
20 {
10 = COA
10 {
stdWrap.wrap = <div class="col-sm-3">|###error_member-tickets-{field:event_date}###</div>
stdWrap.insertData = 1
10 = TEXT
10.value = <input ... id="member-tickets-{field:event_date}" name="###formValuesPrefix###[member-tickets-{field:event_date}]".../>
10.stdWrap.insertData = 1
20 = TEXT
20.field = price_member
20.wrap = <label class="control-label">| € | Mitglied</label>
}
}
}
}
Für die ErrorChecks muss ich nun natürlich auch diese dynamisch generierten Felder deklarieren. Mit diesem Code hab ich's versucht, allerdings werden die relevanten Felder nicht als "required" (*) markiert.
Funktioniert das überhaupt in dieser Form? Gibt es eine andere (bessere) Vorgehensweise / Lösung?
lib.concertfieldchecks = CONTENT
lib.concertfieldchecks {
table = tx_news_domain_model_news
select {
pidInList = 3
orderBy = event_date
selectFields = title,event_date,price_member,price_non_member
where = event_date > ###today### AND sold != '1' AND called_off != '1' AND deleted=0 AND hidden=0
markers {
today.data = date: U
}
}
renderObj = COA
renderObj {
stdWrap.wrap = 1.config.fieldConf.|
10 = TEXT
10.field = event_date
10.noTrimWrap = |member-tickets-|.errorCheck.1 = required|
}
}
plugin.Tx_Formhandler.settings.predef.formhandler-ticket-reservationform {
validators {
1.class = Validator_Default
1.config.fieldConf.stdWrap.cObject = COA
1.config.fieldConf.stdWrap.cObject {
10 = TEXT
10.value (
nachname.errorCheck.1 = required
vorname.errorCheck.1 = required
email.errorCheck.1 = required
email.errorCheck.2 = email
member.errorCheck.1 = required
//message.errorCheck.1 = required
)
20 < lib.concertfieldchecks.renderObj
}
}
}
Gruß, Johannes.
More information about the TYPO3-german
mailing list