Skip to main content


Showing posts from February, 2013

A Quick Javascript Contact Form

function validateForm()
var x=document.forms["myForm"]["name"].value;
var x=document.forms["myForm"]["email"].value;

if (x==null || x=="" || y==null || y=="")
 document.getElementById('myDiv').innerHTML = '<span style="font-weight:bold;color:#800000">***Please fill in all requred fileds.</span>';
  return false;

<div id="myDiv"> </div>
<div id="comments">
<form action="thank-you.aspx" method="post" name="myForm" onsubmit="return validateForm()">
            <input type="text" name="name" id="name" value="" size="22">
            <label for="name"><small>Name (required)</small></label>
            <input type="…

UMBRACO Razor - Write Out a Sub String and Write out a Substring Encoding

The Highlighted lines below shows you how to write out a Substring from Razor in Umbraco.

1) @Html.Raw(@item.HomePageIntro.ToString().Substring(0, 290))
2)@item.HomePageIntro.ToString().Substring(0, 290)

(Example 1 will write out the HTML characters, Example 2 removes Encoding.)
Example of writing out a SubString in Umbraco using Razor @inherits umbraco.MacroEngines.DynamicNodeContext
@{ var numberOfItems = 6; }
    @foreach (var item in @Model.Children.Where("Visible").Take(numberOfItems))
        <figure><img src="images/triangle.jpg" alt=""></figure>
        <strong>@item.PageHeading </strong>
        <p>@Html.Raw(@item.HomePageIntro.ToString().Substring(0, 290))...</p>
<p class="more"><a href="@item.Url">FIND OUT MORE</a></p>