【问题标题】:How to add the placeholder attribute to input fields如何将占位符属性添加到输入字段
【发布时间】:2017-10-09 17:17:31
【问题描述】:

文档中没有任何内容,将其添加到 .isml 文件中不起作用。

<isFormField formparameter="#webform:PhoneHome#"
    label="account.default_address.phonehome.label" 
    messageprefix="#addressKeyPrefix#"
    value="#valuePhoneHome#"
     placeholder="1-234-567-9810"
>

【问题讨论】:

  • IS7.9中找不到这个模块的定义。你能检查这是否是自定义代码吗?

标签: intershop


【解决方案1】:

这是定义。它没有占位符输入参数。您必须覆盖此模块并对其进行扩展。

在这里找到它:

app_sf_responsive/staticfiles/cartridge/templates/default/modules/address/forms/inc/Modules.isml

Parameters:
    - formparameter (mandatory)
        The form parameter which delivers default values for id and value as well as logic for validation and error messages
    - id
        Used to link label and input field. If no id is specified, one will automatically be generated from the from parameter
    - label
        The text displayed as the form field's label. Can be a localization tag as well as a hard coded string. If no label parameter is specified, no label will be rendered
    - value
        Used to prefill the input field. If no value parameter is defined, the form parameter's value will be used as fallback
    - fieldname
        The name of the input field
    - groupclass
        CSS class which is appended to the div surrounding label and input field
    - showtooltip (default=false)
        If it is true, a tooltip will be rendered, the following tooltip parameters are required
    - tooltip_linktext
        If a tooltip is rendered, this text is displayed as the tooltip's link text. Can be a localization tag as well as a hard coded string
    - tooltip_headline
        If a tooltip is rendered, this text is displayed as the tooltip's headline. Can be a localization tag as well as a hard coded string
    - tooltip_content (mandatory for tooltips)
        This text is displayed as the tooltip's content text. Can be a localization tag as well as a hard coded string. If no tooltip_content parameter is set, no tooltip will be rendered at all

<ismodule template="modules/address/forms/inc/FormField" 
    name="FormField"
    attribute="formparameter"
    attribute="id"
    attribute="label"
    attribute="value" 
    attribute="fieldname"
    attribute="groupclass"
    attribute="messageprefix"
    attribute="showtooltip"
    attribute="tooltip_linktextkey"
    attribute="tooltip_headlinekey"
    attribute="tooltip_contentkey"
    strict="true"
/>

要扩展,请在您的自定义墨盒中创建 Modules.ismlFormField.isml 模板。确保使用新 isml 模板向导中的“覆盖现有”按钮,以便覆盖 app_sf_responsive 购物车中的 isml 文件。

将占位符属性添加到Modules.isml 并在FormField.isml 模板中读出。在表单中使用新修改的模块。

【讨论】:

  • “覆盖现有”按钮?不知道那个。对于其他模板覆盖,我刚刚将它们放在自定义墨盒中的相同文件路径中。
  • 很好 :) 好像我们没有我们 app_sf_reponsive 所以我的搜索失败了;)
【解决方案2】:

从 Intershop 7.6 开始,您可以直接对作为 a_responsive 的一部分交付的 isml 进行更改,而无需覆盖。 无论如何,我会为此跟踪缺陷。所以我们也可以修复它。你用的是什么版本?

【讨论】:

  • 这不是答案,更适合作为对原始问题的评论。
  • 我也不推荐这种方法。如果您想升级 Intershop 并使用新版本的 a_responsive 墨盒,那么您不能简单地复制/粘贴新的源代码而不会丢失自定义代码。不过,这确实是一种选择。
猜你喜欢
  • 2016-05-15
  • 2012-01-19
  • 1970-01-01
  • 2013-01-17
  • 2017-07-13
  • 2011-09-17
  • 2015-09-18
  • 2015-07-01
  • 2015-11-05
相关资源
最近更新 更多