This repository serves as a complete example of a form with different types of fields, including required validations and custom text fields.
The components are meticulously structured, following the BEM (Block Element Modifier) and ITCSS (Inverted Triangle CSS) architecture, ensuring easy maintenance and scalability as the project grows.
Integrating client-side JS validations enhances the user experience by providing real-time feedback as they interact with form fields.
Whether you want to improve your form building skills or are looking for organizational inspiration, these components provide an excellent starting point. They provide a valuable reference for other web development projects, provide a solid CSS class structure, powerful client-side JS validations, and unique custom elements.
The best part is that you can easily customize these components to fit your specific project requirements, making them adaptable and valuable for various web development endeavors.
This project is developed inside of src folder, using in HTML, CSS (with the SASS preprocessor) and JS (with the Jquery library).
To streamline the build process, the project utilizes the Gulp task runner, which compiles and optimizes the files, placing them in the dist folder.
Once everything is ready, the project is published using an NPM script in the gh-page branch on GitHub.
Here are the main technologies and tools used in this project:
JQuery 3.4.1
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
jQuery Validation 1.19.1
This jQuery plugin makes simple clientside form validation easy, whilst still offering plenty of customization options. It makes a good choice if you’re building something new from scratch, but also when you’re trying to integrate something into an existing application with lots of existing markup. The plugin comes bundled with a useful set of validation methods, including URL and email validation, while providing an API to write your own methods. All bundled methods come with default error messages in english and translations into 37 other languages.
Some more methods are provided as add-ons, and are currently included in additional-methods.min.js in the download package. You can find the source code for all additional methods in the GitHub repository.
CKEditor 4
Modern JavaScript rich text editor with a modular architecture. Its clean UI and features provide the perfect WYSIWYG UX ❤️ for creating semantic content. It is full of features like pasting from Word, Excel and Google Docs. It's excellent table support with column resizing, row and column selection. You can include multimedia embeds as insert images, videos, tweets, Instagram posts widgets, code snippets, mathematical formulas and more. It has spreadsheets to create data grids within the editor. It uses autocomplete, @mentions, emoji 😊, styling and formatting plugins (copy formatting feature). It is designed with inline and iframe UI, autogrow, maximize mode for distraction-free typing with the read-only mode ...and more!
Here you can see the README.md file of this project and the samples folder.
As mentioned above, this project makes use of the Gulp task runner. The gulpfile.js file contains several Gulp tasks designed to:
- Compile and compress
SASSandJSfiles. - Copy and paste
HTMLfiles andICOMOONicon fonts. - Create a server and enable live reloading using Browsersync + Gulp.js.
So project development takes place in the src and the final optimized content is generated in the dist folder for publishing. This setup ensures an efficient and organized workflow for web development.
npm installsrc folder is finished, you can publish the project with the contents of the dist folder to Github Pages (gh-pages branch).
npm run deployThe default gulp task handles various tasks:
-
Creates the
distfolder if it does not exist. -
Build
html,css,jsand font icons oficomoonin thedistfolder. -
Watch for changes inside the
srcfolder to rebuild the files. -
Sets a server and reloads it automatically when changes are made to the
distfolder.
gulpThis command is able to:
-
Create a static server with the
browserSyncpackage. -
Serve the files in the
distfolder. -
Open the default
index.htmlfile in any of these browsers:ChromeandFirefox.
gulp serveThis command is a powerful tool that performs the following tasks:
- Create and launch a server.
-
Observe the changes in the
html,sass,icomoonandjsfiles located inside thesrcfolder. -
When a change occurs, runs the necessary tasks to re-generate the files inside the
distfolder. -
Consequently, it reloads the server automatically, if there are any changes in the files inside the
distfolder.
This ensures a smooth development experience, as you can make changes to your source files and see updates in real time without manually refreshing the page.
gulp watchThis command is able to:
-
Creates the
distfolder if it does not exist. -
Build the
html,css,jsandicomoonondistfolder.
gulp buildThis command is able to:
-
Creates the
distfolder if it does not exist. -
Copies the
htmlfiles from thesrcfolder to thedistfolder.
gulp htmlThis command is able to:
-
Creates the
distfolder if it does not exist. -
Performs a series of processes:
-
Compiles the
styles.sassfile, including its imported partials located atsrc/sass/. -
Adds prefixes to
CSS. properties for better browser compatibility. -
Compresses the
CSS. file to reduce its size for optimized performance. -
Creates and adds a
mappingfor the debugger styles in the browser inspector for easier debugging. -
Applies a Gulp Plugin,
Line Ending Corrector, to ensure consistent line endings in yourCSS. files.
-
Compiles the
-
Export the
styles.min.cssfile todist/css/folder.
gulp cssThis command is able to:
-
Creates the
distfolder if it does not exist. -
Copies files of
JSlibraries fromsrc/js/libsand pastes them intodist/js/libsfolder. -
Performs a series of processes:
-
Compile partials
JSfiles partials located atsrc/js/. -
Use
Babel, a JavaScript compiler, to ensure backward compatibility and compatibility with various browsers. - Minifies the concatenated file, reducing its size for optimized performance.
-
Applies a Gulp Plugin,
Line Ending Corrector, to ensure consistent line endings in yourJS. files.
-
Compile partials
-
Export the
scripts.min.jsfile todist/jsfolder.
gulp js
This project uses icons from icomoon.io, an online tool app that has 2 buttons to generate SVG & More and generate Font.
The src/icomoon/ folder contains a mix of both downloaded folders.
This command is able to:
-
Creates the
distfolder if it does not exist. -
Gets
style.cssfile fromsrc/icomoon/folder, generates a new compressed file, renames itfonts.min.cssand export the file todist/icomoon. -
Copy directory
src/icomoon/fonts, containing the fonts (EOT, SVG, TTF, WOFF), and paste the files intodist/icomoon/fonts
gulp iconThere is still room for improvement in validation, such as the implementation of showing/hiding fields dynamically as the user fills/hides them... and many other potential areas.
