This project is read-only.

Script resource cannot be found

Topics: Customizing Orchard
Jan 5, 2012 at 7:23 AM
Edited Jan 5, 2012 at 7:26 AM


I created a custom theme named MyTheme and then I added search form widget in second aside zone.
I would like to add a watermark to search text field so I'm trying to use jquery watermark plugin.

I override Parts.Search.SearchForm.cshtml and then in this template, to use the plugin, I added:


I put jquery.watermark.min.js in MyTheme\Scripts folder but when I run the site, the script cannot be found.

In which folder do I have to put the script?

Jan 5, 2012 at 11:57 AM


I found the problem: in the Scripts folder I didn't copy a web.config configured with the permissions to access the js file.
This is the web.config content:

<?xml version="1.0" encoding="UTF-8"?>
    <add key="webpages:Enabled" value="false" />
      <!-- iis6 - for any request in this location, return via managed static file handler -->
      <add path="*" verb="*" type="System.Web.StaticFileHandler" />
    <handlers accessPolicy="Script,Read">
      iis7 - for any request to a file exists on disk, return it via native http module.
      accessPolicy 'Script' is to allow for a managed 404 page.
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />

Jan 5, 2012 at 12:17 PM


I found a better way to manage watermark: I used the new placeholder attribute available in HTML 5, so I simply customized search form template in this way:

@Html.TextBox("q", (SearchViewModel)Model.ViewModel.Query, new { placeholder = "Search" })

Unfortunately, placeholder attribute is not supported in IE 9 but it will be supported in IE 10 (see,VS.85).aspx).

Jan 5, 2012 at 8:54 PM

Yes, but as it's not essential for the feature to work, I'd go for the simplicity of that solution. People who want a better experience should use another browser. Did I say that out loud?

Jan 6, 2012 at 5:23 AM


I totally agree with you. With placeholder attribute is very easy to add watermark to search form instead of using a jQuery plugin.
Who wants watermark should use another browser for now but I think IE 10 is not far.