swille
swille

Reputation: 841

How to add the placeholder attribute to input fields

Nothing in the docs, and adding it to the .isml file doesn't work.

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

Upvotes: 2

Views: 394

Answers (2)

Willem Evertse
Willem Evertse

Reputation: 1239

Here is the definition. It doesn't have a placeholder input parameter. You would have to override this module and extend it.

Found it here :

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"
/>

To extend, create a Modules.isml and FormField.isml template in your custom cartridge. Make sure you use the "override existing" button in the new isml template wizard so you override the isml files in app_sf_responsive cart.

enter image description here

Add the placeholder attribute to Modules.isml and read it out in the FormField.isml template. Use your newly modified module in a form.

Upvotes: 4

Johannes Metzner
Johannes Metzner

Reputation: 971

Since Intershop 7.6 you can make changes to isml delivered as part of a_responsive directly without the need to override. I'll track a defect for this anyways. So we can fix it as well. What version are you using?

Upvotes: 1

Related Questions