This article is about interactive (registration) sites. However you may also be able to use this technique on some portals.
Sometimes, you may want to limit the number of characters that can be added into a field.
You can do this by adding the code (script) below into your interactive (registration) site.
You can add it under the Details tab (and then in the SEO tab), in the "Additional <HEAD> Code" section.
The code below is an example, so you'll need to adapt it for your own use:
<script> document.addEventListener('DOMContentLoaded', function() { // Select all elements with 'id' attribute containing the specific substring document.querySelectorAll('[id*="4aa65410-ebe7-4027-96a7-bb2b6e9810b5_AddressCity"]').forEach(function(element) { element.setAttribute('maxlength', '6'); }); }); </script>
You need to replace the ID of the field - the bit that comes after [id*=
- everything inside the quotation marks in the example script above - with the acutal ID of the field you want to limit the characters for.
To find the correct field ID, visit your interactive (registration) site as though you were an attendee, and right-click on the field you want to limit characters for.
Choose "Inspect" and look at the highlighted text in the Inspect panel. [These are the instructions for Chrome; your browser may vary.]
You should see a highlighted section of text that includes id="
You need to copy everything within the quotation marks. This will likely be a string of numbers and letters, separated by hyphens, and perhaps a field name.
Don't include the quotation marks in what you copy.
Go back to where you added the code/script, and replace what's inside the quote marks after id= (the value for ID) with what you just copied. Make sure you keep the quotation marks at the beginning and end.
You also need to replace the number [6 in the example above] with the character limit you want to apply.
Save and test your interactive (registration) site.
You may also want to add information / help text to explain the character limit.
If you want to apply this character limit to other fields too, copy this part of the code/script (which will now have your new values in it):
document.querySelectorAll('[id*="4aa65410-ebe7-4027-96a7-bb2b6e9810b5_AddressCity"]').forEach(function(element) { element.setAttribute('maxlength', '6'); }); });
And paste it in as many times as you need it, underneath the previous ones, keeping everything before </script>
Then replace / amend the field names and character numbers as needed.
You may also be able to use this technique on selected portals - for example, on the Abstract Submission page of a Presentation Portal.
To do this, go to the Content tab for the portal and select the page you want to work on.
Open the HTML element and use the Tools - Source Code feature to see the HTML.
Paste the script below any existing content, then follow the same process as above to obtain the correct field IDs and alter the maximum character count.
Save and test your portal. Remember, you're adding a character count, not a word count.
The above code is supplied as a courtesy for your convenience and our Support staff are unable to provide any additional web development services.