Client Side and server side 2 multi paradigm language Programming paradigms are

Client side and server side 2 multi paradigm language

This preview shows page 11 - 16 out of 29 pages.

Client Side and server side
Image of page 11
2. multi paradigm language Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms. multi paradigm language is supports more than one programming paradigm 3. Server-side versus client-side code Client-side code is code that is ran on the user’s computer - when the page is viewed, the client side code is downloaded and then run and displayed by the browser . This is what we call client-side JavaScript. JavaScript can also be used as server-side . Recently, there is a huge surge in the popularity of using JavaScript as server side code in the Node.js environment. 4. JavaScript Libraries and Framework Libraries is Pre Written JavaScript which allows for easier development of JavaScript applications. framework defines the entire application design. JavaScript libraries jQuery, jQueryUI, Google Maps Platform, Leaflet.js, d3.js frameworks: AngularJS, VueJs, React 5. JQuery Make using JavaScript easier to accomplish Default syntax : $(selector).action() 5.1 jQuery Syntax The document ready function is used so that jQuery runs after all objects in the page are loaded. $(document).ready(function() { alert('Welcome to jQuery'); }); 5.2 Alternate Syntax $(function() { alert('Welcome to jQuery'); }); 6. DOM- Document Object Model
Image of page 12
Week 6 Validations 1. Validations Concepts Input Validation: correct format and data type not null fields data types E.g. dates, numeric and text fields data is within valid ranges E.g. age (ranges) specific format E.g. email addresses or post codes etc. 2. Validations for Security Validation to minimise security issues • E.g. code injection attacks • Server and Client side validation • client side validation is easier to by pass for a knowledgeable user • Client side validation is recommended to reduce round trips to the server
Image of page 13
• Server side validation for additional security 3. Validation in ASP.Net MVC • Main aspects to implementing validation in ASP.Net MVC Applications: • Validation in Models • Validation in Views • Validation Error Messages 3.1 Validation in Models • Models can be annotated to support validation in ASP.Net MVC Applications • The field in the model is annotated with the relevant annotation [Required(ErrorMessage = "Please Enter Name")] 3.1.1 Built in Validation Support • Range Validation – [Range(0, 1000, ErrorMessage = "Enter price between 0 to 1000")] • Data Type Validation – [DataType(DataType.Date)] • Length Validation – [StringLength(255, MinimumLength = 8)] • Regular Expression Validation
Image of page 14
• Etc… – [EmailAddress] 3.1.2 Common Regular Expression Syntax( 正则 ) 3.2 Validation in Views • Autogenerated View include the Validation helpers @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" }) • A customised Error message can be given 3.3 Validation Error Messages • Standard Error Messages can be added in the Model Annotation • A customised Error message can be given in the view @Html.ValidationMessageFor(model => model.Name, "Please Enter a Name", new {
Image of page 15
Image of page 16

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture