O'Reilly logo

Moodle JavaScript Cookbook by Alastair Hole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Moodle Forms Validation

In this chapter, we will cover:

  • Adding a required field
  • Adding a field with a maximum length
  • Adding a field with a minimum length
  • Adding a field length within a specified range
  • Adding a valid e-mail address field
  • Adding custom validation with a Regular Expression
  • Adding a field that accepts only alphabetic characters
  • Adding a field that accepts only alphanumeric characters
  • Adding a field that accepts only numeric characters
  • Rejecting punctuation characters
  • Rejecting input without a leading zero
  • Comparing with another field
  • Adding a custom JavaScript validation function callback

Introduction

We often need to collect information from a user for a variety of reasons. For example, we get contact details or information about a problem ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required