├── LICENSE ├── README.md └── index.html /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Franz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stop Form Spam: The Custom Tag Method 2 | 3 | A reliable method to prevent spam bots from completing input, select and textarea fields and from submitting online forms (e.g. contact forms) 4 | 5 | ## How it works 6 | 7 | Use a small bit of Javascript to convert custom tags to valid form tags. 8 | 9 | ## Usage 10 | 11 | The example below converts \\ tags to input, select and textarea tags after the page loads. This means the page html does not need to contain such tags and spam bots cannot populate them. The JS is very fast, so human page visitors do not notice the conversion. 12 | 13 | 1. Add an opening and a closing tag (!) with the name f-f 14 | ```html 15 | 16 | ``` 17 | 2. Add an "el" attribute with the element you want to create 18 | ```html 19 | 20 | 21 | 22 | 23 | ``` 24 | 3. Add any attributes you want your element to have 25 | ```html 26 | 27 | 28 | 29 | 30 | 31 | Submit 32 | 33 | ``` 34 | 4. Add the script below to the page. When the page loads it creates a new element using the "el" attribute in all f-f elements. It then adds all other attributes and all child elements to the new element before removing the f-f element from the DOM. 35 | ```html 36 | 70 | ``` 71 | 72 | ## Full Example 73 | ```html 74 |
75 |
76 | Your Name 77 | 78 | 79 |
80 |
81 | Email 82 | 83 |
84 |
85 | Message1 86 | 87 |
88 |
89 | Message2 90 | 91 |
92 |
93 | Select 94 | 95 |
96 |
97 | Checkboxes 98 | 99 | 100 |
101 |
102 | Radio Buttons 103 | 104 | 105 |
106 | Submit  107 |
108 | 130 | ``` 131 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | FormSpam Prevention 8 | 9 | 10 |
11 |
12 | Your Name 13 | 14 | 15 |
16 |
17 | Email 18 | 19 |
20 |
21 | Message1 22 | 23 |
24 |
25 | Message2 26 | 27 |
28 |
29 | Select 30 | 31 | 32 | 33 | 34 |
35 |
36 | Checkboxes 37 | 38 | 39 |
40 |
41 | Radio Buttons 42 | 43 | 44 |
45 | Submit  46 |
47 | 69 | 70 | 71 | --------------------------------------------------------------------------------