Click here to Skip to main content
15,881,380 members
Articles / Web Development / HTML

Implementing RequireJs on BackboneJs

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
3 May 2012CPOL2 min read 24.6K   680   11  
Updating the MVC music store app with RequireJS on BackboneJs
@model RazorApp.Models.Order

@{
    ViewBag.Title = "Address And Payment";
}


<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('input[type=text], textarea, input[type=password]').width(200);
        $('#valSum').hide();

        $('form').bind('invalid-form.validate', function (error, element) {
            $('#valSum').show("slow");
            return false;
        });
    });
</script>
@if (!ViewData.ModelState.IsValid) {
<script type="text/javascript">
    $(function () {
        $('#valSum').show("slow");
    });
</script>
}

@using (Html.BeginForm()) {
    
<div class = "styler">
    <div id = "valSum" class="ui-state-error ui-corner-all" style="padding: 0 .7em;width:500px"> 
		<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
		<strong>Please correct these Errors</strong> @Html.ValidationSummary(false, "")</p>
	</div>
    <fieldset class="ui-widget">
        <legend class="ui-state-legend-default ui-corner-top ui-corner-bottom">Shipping Information</legend>
        @Html.EditorForModel()
    </fieldset>
    <fieldset class="ui-widget">
        <legend class="ui-state-legend-default ui-corner-top ui-corner-bottom">Payment</legend>
        <p>We're running a promotion: all music is free 
            with the promo code: "FREE"</p>
        <div class="editor-label">
            @Html.Label("Promo Code")
        </div>
        <div class="editor-field">
            @Html.TextBox("PromoCode")
        </div>
    </fieldset>
    
    <input type="submit" value="Submit Order" />
    </div>
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions