I have a view where I have a textbox where the user can enter url and process the request. What I want to do is to include client side validation that the url is in a proper format.
Here is what I have:
<fieldset>
<p>
<%=Html.Label("Please enter URL:") %>
<%=Html.TextBox("url")%>
<%= Html.ValidationMessage("url", "*") %>
<input type="submit" value="Crawl" />
</p>
</fieldset>
Any advice how I can include client side validation for that piece of code?
Thanks in advance, Laziale
Use regexular expression attribute in your model to validate the url.
Than, if you are using the jquery unobtrusive validation, the rest is taken care of by the framework
For mvc2 validation done client-side try taking a look to this post also