I followed exactly the typo3 formhandler "how-to-set-up-a-simple-form". The standaard form works, but when I add the validation part the form post will give a white screen. I used the typoscript below. What causes the from to go to a white screen after the validation?
plugin.Tx_Formhandler.settings {
validators.1.class = Validator_Default
validators.1.disabled = 0
validators.1.config.fieldConf {
message.errorCheck.1 = required
message.errorCheck.2 = minLength
message.errorCheck.2.value = 5
sender_name.errorCheck.1 = required
sender_email.errorCheck.1 = required
sender_email.errorCheck.2 = email
}
addErrorAnchors = 1
singleErrorTemplate {
totalWrap = |
singleWrap = <span style="color: red;">|</span>
}
errorListTemplate {
totalWrap = <div style="color: red;">Es sind folgende Fehler aufgetreten: <ul>|</ul></div>
singleWrap = <li>|</li>
}
debug = 0
langFile = fileadmin/templates/sandraverdijck/lang/lang-contactform.xml
templateFile = fileadmin/templates/sandraverdijck/html/contactform.html
formValuesPrefix = formhandler
finishers {
1 {
class = Tx_Formhandler_Finisher_Mail
}
2 {
class = Tx_Formhandler_Finisher_SubmittedOK
config.returns = 1
}
}
}
So in this case you find your solution here.
Summary: mb_strlen is not enabled by default. You have to do that.
Related
TYPO3 11.5.2
I want to display felogin using typoscript with a customized template at position:
<f:cObject typoscriptObjectPath="lib.loginBox" />
The original template should be used if felogin is added as a page content element.
The following code works, but changes the view for all felogins:
plugin.tx_felogin_login {
settings.pages = 15
view {
templateRootPaths {
0 = fileadmin/template/current/felogin/Resources/Private/Templates/
10 = {$plugin.tx_felogin_login.view.templateRootPath}
}
}
}
lib.loginBox = USER
lib.loginBox {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Felogin
pluginName = Login
}
To apply different templates for 1) and 2) I thought the following could work, but it doesn't:
lib.loginBox = USER
lib.loginBox {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Felogin
pluginName = Login
settings < plugin.tx_felogin_login.settings
settings.pages = 15
view < plugin.tx_felogin_login.view
view {
templateRootPaths {
0 = fileadmin/template/current/felogin/Resources/Private/Templates/
10 = {$plugin.tx_felogin_login.view.templateRootPath}
}
}
}
EDIT: the second version does not use the custom template at all and the settings.pages = 15 doesn't work => no login possible. With the first version login is working.
Any hints what's wrong with this approach?
How I can achieve different templates for 1) and 2) ?
Edit: Solution as it works for me now:
plugin.tx_felogin_login {
settings.pages = 15
}
lib.loginBox = USER
lib.loginBox {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Felogin
pluginName = Login
view < plugin.tx_felogin_login.view
view {
templateRootPaths {
10 = {$plugin.tx_felogin_login.view.templateRootPath}
#20 = fileadmin/template/current/felogin/Resources/Private/Templates/
#should be something like:
20 = EXT:myfelogin/Resources/Private/Templates/
}
}
}
Problem is the sorting of your templates!
lib.loginBox = USER
lib.loginBox {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Felogin
pluginName = Login
settings < plugin.tx_felogin_login.settings
settings.pages = 15
view < plugin.tx_felogin_login.view
view {
templateRootPaths {
10 = {$plugin.tx_felogin_login.view.templateRootPath}
20 = fileadmin/template/current/felogin/Resources/Private/Templates/
}
}
}
As 20 is higher than 10, the template in fileadmin will be used.
Just as side note: you should always create a site package extension containing all those files and not put them into fileadmin.
I'm using TYPO3 7.6.3with the great News-Extension from Georg Ringer news 4.1.0.
I need the Tag-Search from tx_newsas a Select-Box, so I include the Plugin and change the Template /EXT:myext/Resources/Private/Extensions/News/Templates/Tag/List.html from a ul/li-List to the selectbox. This part is working fine!
But I need this select-box not as a Content Element, I need it at my Footer-Navigation, which I made with TypoScript. How can I use the tx_news-Template (Tag/List.html) into my Footer-Partial?
Here's the screen:
My version of the tag-list .. as a search box
I'v tried it like this ..
...
20 = CONTENT
20 {
table = tx_news_domain_model_tag
select {
selectFields = tx_news_domain_model_tag.title
orderBy = tx_news_domain_model_tag.title asc
### pid folder 'tags'
pidInList = 32
}
renderObj = COA
renderObj {
10 = TEXT
10.field = uid
10.wrap = <option value="|">
10.wrap.insertData = 1
20 = TEXT
20.field = title
20.wrap = |</option>
20.wrap.insertData = 1
}
}
20.wrap = <form method="get" action="/index.php"><input type="hidden" name="id" value="17" /><select name="tx_news_pi1[overwriteDemand][tags]"><option value="" selected>Tag Suche</option>|</select></form>
...
and it works (thanks colin!)!
Also helpful: https://www.auxnet.de/typo3-datenbankabfragen-mit-typoscript/
Im trying to show a LIB on some pages, but i dont want to shwo it on page UID 7.
But the lib is not showed at all, have tryed to look at the Uid 3-4-5-6 and 7.
I have this TS code.
[globalVar = TSFE:id <> 7]
lib.siteContact = COA
lib.siteContact {
wrap = <div class="pagecontent-box-content" id="pagecontent-box-content-59">|</div>
10 = TEXT
10.value = <h2><em>Kundeservice</em></h2>
20 = TEXT
20.value = <img alt="" src="fileadmin/templates/add/images/kundeservice.jpg" style="width: 166px; height: 89px; border-width: 0px; border-style: solid;" /><br />
30 = TEXT
30.value = <h2><em>Tlf. 69 144 145</em></h2><br />
}
[end]
What do i do wrong
I think there's no unequal sign in TypoScript conditions. One way to do negations would be to use the else statement.
[globalVar = TSFE:id = 7]
lib.siteContact = COA
lib.siteContact {
...
}
[else]
...
[global]
Show your lib on all pages and clear (or override) it if UID is 7:
lib.siteContact = COA
lib.siteContact {
// rest of your code
}
[globalVar = TSFE:id = 7]
lib.siteContact >
[end]
I have an ajax form which which is currently returning errors using the S.error() method. This is fine but I also want to add a new css class to one of the elements parent div tags. I have tried to do this with the JE.Call() method with no avail. Is anyone could point me in the right direction it would be really appreciated.
Snippet Code
class Register {
private var user = User.createRecord
private var pw2 = ""
private var dob = ""
private var errors = new Array[String](7)
val whence = S.referer openOr "/"
Thread.sleep(400)
def registerUser(): JsCmd = {
errors(0) = User.validateUsername(user.username.is)
errors(1) = User.validateEmail(user.email.is)
errors(2) = User.validatePhone(user.phone.is)
errors(3) = User.validateCity(user.city.is)
errors(4) = User.validateDOB(dob)
errors(5) = User.validatePassword(user.uPw.is)
errors(6) = User.validateSecondPW(user.uPw.is, pw2)
if(errors.count(_ != "") == 0) {
user.uPw.set(User.hashPassword(user.uPw.is, user.id.is.toString))
user.dob.set(User.stringToDate(dob))
user.save
println("User id " + user.id.is.toString + " added to database")
S.redirectTo(whence)
}else{
if(errors(0) != "")
S.error("username-error", errors(0))
JE.Call("addError(username-error)")
......
}
}
def form = {
"id=username" #> SHtml.text("", user.username.set(_), "placeholder" -> "Username") &
"id=email" #> SHtml.email("", user.email.set(_), "placeholder" -> "Email") &
"id=phone" #> SHtml.text("", user.phone.set(_), "placeholder" -> "Tel") &
"id=city" #> SHtml.text("", user.city.set(_), "placeholder" -> "City") &
"id=dob" #> SHtml.text("", dob = _, "placeholder" -> "DOB") &
"id=password" #> SHtml.password("", user.uPw.set(_), "placeholder" -> "Password") &
"id=passwordCheck" #> SHtml.password("", pw2 = _, "placeholder" -> "Confirm Password") &
"type=submit" #> SHtml.ajaxSubmit("Register", () => registerUser, "class" -> "btn")
}
}
HTML Template
<h2>Register</h1>
<form class="lift:form.ajax?class=form-horizontal">
<div class="lift:Register.form">
<div id="id1" class="control-group">
<label class="control-label" for="username">Username:</label>
<div class="controls">
<input id="username">
<span id="username-error" class="help-inline"></span>
</div>
</div>
<div class="controls">
<button type="submit" ></button>
</div>
</div>
</form>
Javascript Function
<script>
function addError(id) {
$("#"+id).closest(".control-group").addClass("error");
}
addError("email-error")
</script>
Try to change the Call function.
JE.Call("addError","username-error").cmd
I recommend giving up on JavaScript abstractions in Lift and use plain Run Object everywhere. So In your case I'd use:
Run("addError(username-error)")
I created my own custom template and backend layout.
Here is my backend layout code :
backend_layout {
colCount = 3
rowCount = 2
rows {
1 {
columns {
1 {
name = Solution 1
colPos = 1
}
2 {
name = Solution 2
colPos = 0
}
3 {
name = Solution 3
colPos = 2
}
}
}
2 {
columns {
1 {
name = Products 1
colPos = 3
}
2 {
name = Products 2
colPos = 4
}
3 {
name = Products 3
colPos = 5
}
}
}
}
}
Here is my custom template, I just have included the section of html file :
<div class="row" id="solution">
<!-- ###SOLUTIONLEFT### Start-->
<!-- ###SOLUTIONLEFT### End-->
<!-- ###SOLUTIONMID### Start-->
<!-- ###SOLUTIONMID### End-->
<!-- ###SOLUTIONRIGHT### Start-->
<!-- ###SOLUTIONRIGHT### End-->
</div>
<div class ="row" id="product">
<!-- ###PRODUCTLEFT### Start -->
<!-- ###PRODUCTLEFT### End -->
<!-- ###PRODUCTMID### Start -->
<!-- ###PRODUCTMID### End -->
<!-- ###PRODUCTRIGHT### Start -->
<!-- ###PRODUCTRIGHT### End -->
</div>
My page template code is :
page.10.subparts {
SOLUTIONLEFT< styles.content.getLeft
SOLUTIONMID< styles.content.get
SOLUTIONRIGHT< styles.content.getRight
PRODUCTLEFT < styles.content.getLeft
PRODUCTMID < styles.content.get
PRODUCTRIGHT < styles.content.getRight
}
I am trying to display product page info in second row. I am not able to do. So how to display it. Am I following proper way for creating template in typo3?
Can i do something like PRODUCTLEFT = style.content.getLeft.select = where row = 1 to display content from second row in backend?
You are nearly correct. You just need to specify the colPos from the Backend Layout of the content you want to assign to a subpart in your TypoScrip:
page.10.subparts {
...
PRODUCTLEFT < styles.content.get
PRODUCTLEFT.select.where = colPos=3
...
}
styles.content.get styles.content.getLeft and styles.content.getRight are just preconfigured for the default colPos configuration TYPO3 shipps out of the box (0, 1 and 2).