Adding Placeholder to custom contact form input text fields

Topics: Customizing Orchard
Jan 16, 2014 at 2:58 PM

I'm really new to Orchard. I really like it. So far this is the only hurdle I have run into. All I want to do is have a placeholder attribute for all my input form elements. For example for email textbox I want to have Email written in the box to start which then goes away once the user starts typing. Something like this...

@Html.TextBoxFor(model => model.Name, new { @placeholder="Name" })

I would be really grateful on some advice on whether I can do this from within Orchard Admin or which .cshtml file I need to change.

Also just a refresher. If I edit a .cshtml file (client side then I dont need to revuild the application from scratch do I?

Thanks in advance for any help you give.
Jan 20, 2014 at 6:00 PM
First of all changing .cshtml files, doesn't need a application rebuild as it gets compiled runtime, but remember to make this changes to your source, otherwise you run the risk of losing your changes remotely.

For adding a placeholder attribute to your input fields, the code above should work, but your don't need the @ in front of placeholder as its not a reserved keyword like class. If its input fields in a form, you can override the override the input fields rendering using alternates.
Jan 26, 2014 at 9:22 AM
Thank you for your response. Do you know the exact location of the .csthml files for the form controls that I need to change. Thank you.
Feb 3, 2014 at 1:32 PM
Can anyone help with this? Still trying to resolve it.
Feb 4, 2014 at 1:27 PM

Sorry, you do not want to overwrite the initial source code. Use the shape tracing module to create an alternate view and then you update the field using the alternate view.

See the below url for help using shape tracer: