Add placeholder text to input

Jogchem Andre Oord asked on March 23, 2015 17:10

Is it possible to add a placeholder text to a form control? I'm trying to create a custom online ASCX form layout.

I tried the following:

<cms:FormControl runat="server" ID="iEmailadres" Field="Emailadres" FormControlName="emailinput" CssClass="" placeholder="E-mailadres" />

But it doesn't show the (html5) placeholder. Is there another way to achieve this functionality?

Update:

Instead of showing the placeholder attribute in the input tag, it is shown in the (auto generated) div surrounding the input:

Image Text

Recent Answers


Brenden Kehren answered on March 23, 2015 18:28

Kentico uses the watermark extender from the Ajax Control Toolkit. The placeholder property you are using puts a placeholder around the control. So you'd have to assign the watermark text. It might be better to actually specify a type of control as well like <cms:CMSTextbox> vs the form control, but that depends on your needs I guess.

1 votesVote for this answer Mark as a Correct answer

Jogchem Andre Oord answered on March 24, 2015 13:29

Thanks, changing it to <cms:CMSTextbox> allows me to add the placeholder property. But how do I link it to the form field?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 24, 2015 14:21

The form field is a wrapper for the individual controls, so unless you need it, I'd stick with the individual controls.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.