Last active
December 5, 2025 08:53
-
-
Save carolineschnapp/6081278 to your computer and use it in GitHub Desktop.
Example where customer tags are collected in the REGISTRATION form, and more than one tag.
The server expects a comma-separated list of tags. So we give that list to him via a hidden input field that we update with JavaScript. In the SIGNUP form, it'd be the same code except you replace customer[tags] with contact[tags].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p>I am interested in:</p> | |
| <p> | |
| <input type="checkbox" class="interested-in" value="sunsets">Sunsets<br /> | |
| <input type="checkbox" class="interested-in" value="piña coladas">Piña coladas<br /> | |
| <input type="checkbox" class="interested-in" value="getting lost in the rain">Getting lost in the rain<br /> | |
| <input type="checkbox" class="interested-in" value="songs by rupert holmes">Songs by Rupert Holmes<br /> | |
| </p> | |
| <!-- this is what is submitted to the server --> | |
| <input type="hidden" name="customer[tags]" /> | |
| <script> | |
| jQuery(function() { | |
| jQuery('.interested-in').change(function() { | |
| var tags = ''; | |
| jQuery('.interested-in:checked').each(function(){ | |
| tags += jQuery(this).val() + ','; | |
| }); | |
| jQuery('[name*="tags"]').val(tags); | |
| }); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any way for the customer to come back and modify their tags or is this only available when they first register?