HomeWiki
HomeWiki
  1. Components
  • Back to home
  • 1. Themes
  • Layout
    • New Layout
    • Legacy Layout
  • Components
    • Announcement
    • Banner Carousel
    • Banner With Products Carousel
    • Blog Category List
    • Blog List
    • Brand List
    • Brands Carousel
    • Breadcrumb
    • Call To Action
    • Cart
    • Categories List
    • Change Password
    • Checkout
    • Cookie Manager
    • Filter list
    • Footer
    • Forgot Password
    • Form
    • Hero Carousel
    • Icon Block
    • Invitation
    • Last Visited Products
    • Layout
    • Login
    • Map
    • Nav Bar
    • Offer
    • Product Attachments
    • Product Attributes
    • Product Documentation
    • Product Expected
    • Product Modal
    • Products Block
    • Products Carousel
    • Product Single
    • Profile
    • Quote
    • Register
    • Related Products
    • Search
    • Stores
    • Subscribe Newsletter
    • Text with Image
    • Top Bar
    • Video
  • Reusables
    • Getting Started
  • Assets
    • Getting Started
  • SDK
    • Products
      • _findProductsByCategory
      • _findProductsByIds
      • _findProductsByTitle
      • _findProductsByFilter
      • _findProductsByCriteria
      • _findProductsAndCalculate
      • _findProductsThenCalculate
      • _getProductAttributeSet
      • _setLastVisited
    • Categories
      • _findCategoryTreeById
      • _findCategoriesByIds
      • _findCategoryByAlias
      • _findCategoryTreeByAlias
      • _getCategoryContent
    • Collections
      • _getCollectionContent
      • _findCollectionsByIds
      • _findCollectionsByIdsThenCalculate
    • Brands
      • _getBrandContent
      • _findBrandsByIds
    • Cart
      • _addToCartMulti
      • _addToCart
      • _setCart
      • _clearCart
      • _setCartListener
      • _removeFromCart
      • _calculateCart
    • Checkout
      • _startCheckout
      • _updateCheckout
      • _completeCheckout
    • Shopping Lists
      • _getShoppingLists
      • _updateShoppingList
      • _createShoppingList
      • _deleteShoppingList
      • _getShoppingListByAlias
    • Navigation
      • _getFooterMenu
      • _getHeaderMenu
    • Users
      • _getUserById
    • Utils
      • _calculateCurrency
      • _getCurrencySymbol
      • _getCulture
      • _subscribeToNewsletter
      • _findUnitsByIds
  • Vs Code
    • Getting Started
  1. Components

Register

Register Component Documentation#

Overview#

The Register component is a component designed to handle user registration. It includes form fields for user email, first name, last name, and password, and validates user input to ensure correctness. The component provides real-time feedback on user input errors and handles registration logic, including showing a loading indicator during the process.

Model Documentation#

Model Structure#

The Register component is designed to use a data model that includes:
email: The user's email address.
firstname: The user's first name.
lastname: The user's last name.
password: The user's password.
retypepassword: The retyped password for confirmation.
emailError: Error code related to email validation.
firstnameError: Error code related to first name validation.
lastnameError: Error code related to last name validation.
passwordError: Error code related to password validation.
isloading: A boolean indicating whether the registration process is ongoing.

Example Model#

Here's a sample model configuration:

Component Structure#

The Register component consists of several key parts:
1.
HTML Template: Defines the structure and layout of the registration form.
2.
JavaScript: Contains the logic for form validation and submission.
3.
Methods: Include functionality for form submission and password visibility toggling.
4.
Computed Properties: (Not utilized in this component but reserved for future enhancements.)
5.
Watchers: Watch for changes in password and retypepassword to trigger validation.

HTML Template#

The HTML template defines the structure of the registration form. It includes:
Form Fields: For email, first name, last name, password, and retype password.
Validation Feedback: Displays error messages based on validation results.
Loading Indicator: Shows a spinner during form submission.
Password Visibility Toggle: Allows users to show or hide their password.
Here's the relevant part of the HTML template:

JavaScript#

The JavaScript section contains the logic for the Register component. It includes:
Data Properties: Define the initial state of form fields and validation errors.
Methods:
checkForm(): Validates the form inputs and handles form submission.
toggleVisibility(inputField): Toggles the visibility of password fields.
Mounted Lifecycle Hook: (Currently empty but reserved for future use.)
Watchers: Monitor
changes to password and retypepassword for validation.
Here's the relevant JavaScript:

Explanation#

Form Validation: The checkForm method validates the email, first name, last name, and password fields. It uses regular expressions to check the format of the email and password and provides feedback for different error conditions.
Loading State: The isloading property controls the display of the loading spinner during form submission.
Password Visibility: The toggleVisibility method allows users to toggle the visibility of their passwords for easier input.
Modified at 2024-08-27 10:22:10
Previous
Quote
Next
Related Products
Built with