strongly typed placeholder text?

Aug 21, 2013 at 11:48 AM
cracking work on this, really has filled a gap in the project i'm working on at the moment.

i'd be interested to know if it's possible to use strongly typed placeholder text? currently i've got:
@Html.Html5TextBoxFor(m => m.Email, InputTypes.InputType.Email, new { @class = "formText" })
and my view model has:
[Display(Name = "EmailLabel", ResourceType = typeof(Forms))]
public string Email { get; set; }
the 'EmailLabel' value is coming from a resex file and has the:

Email:

which is loading as the placeholder text but ideally i'd like it to be:

Email address

is there a way to have different text?

cheers,

jake
Coordinator
Aug 23, 2013 at 11:32 AM
Edited Aug 23, 2013 at 11:33 AM
Hi Jake

Thanks for getting in touch.

Unfortunately, at the moment there is no way to use strongly typed placeholder text. This is a good feature idea and I will try and add it to the next release.
What do you think of the following implementation? Instead of calling it like you currently do:

@Html.Html5TextBoxFor(model => model.CustomerEmail, InputTypes.InputType.Email, null, "Email Address")

You would call it like so:

@Html.Html5TextBoxFor(model => model.CustomerEmail, InputTypes.InputType.Email, null, true)

Where 'true' is a boolean based on whether or not to use the strongly typed placeholder. The text for the placeholder will be derived from the property?

Let me know what you think?

Thanks
Dean
Sep 4, 2013 at 9:37 AM
hi dean,

that sounds perfect - being able to automatically load the label text, hard code the value or load it from a separate property covers everything ;)

look forward to the next release, i just downloaded the source of the project for a look-see. that is some well written and commented code sir, great work.

thanks for putting it out there,

jake