TYPO3 - How to add a placeholder to an input field?

余生长醉 提交于 2019-12-12 03:26:52

问题


In TYPO3 (7.2.0) using the standard template engine, is there a way to add a placeholder attribute to the standard mail form text input?

At the moment I am using JavaScript to convert the labels into placeholders, but I am open to suggestions on a better way to do this...


回答1:


The suggested solution of @biesior does only work for EXT:form 7.4 and higher (see changelog). The supplied picture shows the form wizard of TYPO3 7.5 or 7.6. In 7.2 you won't find any placeholder attribute in the wizard.

I recommend updating to TYPO3 7.6 since this version includes a major rewrite of EXT:form. You will be able to use fluid templates to customize your forms. Furthermore HTML5 attributes are possible. Before the rewrite the set of allowed attributes was quite limited. Now you are able to add all attributes you can think of (for example "data-"). See changelog.

If you have any questions regarding EXT:form join the channel on Slack. If you don't know Slack yet, check out the invite function.




回答2:


During form fields editing you have many properties, also Placeholder

in text version it will be:

10 = TEXTLINE
10 {
    type = text
    class = foo-class
    id = foo-id
    name = foo
    placeholder = Hmmm?
    required = required
    label {
        value = My Field
    }
}


来源:https://stackoverflow.com/questions/35929688/typo3-how-to-add-a-placeholder-to-an-input-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!