Jump to content

Limit Character Count on Forms

Go to solution Solved by creedon,

Recommended Posts

Sorry, I always am challenged sifting through the varying text convos.

I think this is what you're meant, correct?

 

/* for formName copy the value from the form editor Form Name field. you

       only need exactly what can be selected from the field */    

    const formName = 'Details';

    const maxLength = 128;

     /* for textAreaLabel copy the value from the form Text Area field editor

       LABEL field. you only need exactly what can be selected from the field */

     const textAreaLabel = 'Card Message';

Link to comment
37 minutes ago, ThePromoTeam said:

Sorry, I always am challenged sifting through the varying text convos.

I think this is what you're meant, correct?

The code you show is only the settings. The full code is cited in the post I have referenced several times in this thread.

In other words the full code is not in this forum but can be found by following the link in the post I have referenced.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 2 months later...
  • 4 months later...

Hi there! I had this all integrated on my site and it was working PERFECTLY for 6 months +, then early last week I started to have some issues. First, the text boxes with the ftfml placeholder text just wouldn't appear on the front end, but now the ftfml placeholder text is displayed in the boxes but does not limit the characters. 

Any advice or guidance is super appreciated! Let me know if I can provide any additional info, I removed the ftfml placeholder for now. 

Here's the form of interest: https://www.activeimpactinvestments.com/entrepreneur 

Link to comment
2 hours ago, kelleymacdonald said:

Any advice or guidance is super appreciated!

SS recently updated forms and it's been slow going getting old code to work with the new form blocks.

I'm a bit swamped with form madness at the moment.

I'll contact you via DM for a potential short term work around but eventually I'd like to release a new version of the my code.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 5/8/2023 at 1:16 PM, kelleymacdonald said:

I had this all integrated on my site and it was working PERFECTLY for 6 months +, then early last week I started to have some issues.

Please see Form Block Text Field Max Length.

From the read me.

Squarespace is currently in the process of updating form blocks. This code is developed against forms in this transition state. I expect the code will soon need a minor update to work with the finalized version of form blocks.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 5/8/2023 at 3:44 PM, creedon said:

I'll contact you via DM for a potential short term work around but eventually I'd like to release a new version of the my code.

I would also love a DM of a short term work around as I've had to remove the formatting from my form to get it to work properly. Thanks. 

Edited by dkyby
Link to comment
  • 4 months later...
On 11/21/2020 at 6:53 PM, creedon said:

Please see Form Text Field Max Length.

The dialog you show in your post is not available for easy modification (it's not on the DOM initially) so we have to use a MutationObserver to watch for the dialog to become available. Once it is available we can add the maxlength attribute to the text field to limit the number of characters to 250.

Let us know how it goes.

@creedon I've implemented the above. But on google chrome the field doesn't show up and then it also doesn't show up when the page is in light box. Example... There is a light box button on the bottom of this page... https://deer-round-496d.squarespace.com/?p?p and here is the page it lightboxes too. https://deer-round-496d.squarespace.com/contact?p

Link to comment
1 hour ago, KR2 said:

I've implemented the above.

My code isn't designed to work with 3rd party code such as Lightbox Anything.

I suspect that my code and LA may be clashing.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 1 month later...

I'm a web developer who recommended SquareSpace to someone for easy website creation, and I am shocked by how bad the form support and customization options are. It's 2023, and people can't set a simple max character limit on their textarea components? Our only options are to copypasta some JS code that can break whenever SS updates their form components next? I even tried inserting the copypasta provided here sitewide, but then the Contact form fails to load entirely. The whole point of SS is to avoid headaches like this. I can't recommend it to anyone else after seeing these issues.

@creedon thanks for your support in trying to help people get through this, but it's still crazy to me how common use cases like this and also unique Subject form submissions do not have out-of-the-box solutions with SS. 

Edited by MitchD
adding acknowledgement for creedon's help
Link to comment
  • 3 months later...

Thanks for this @creedon! The character count will help a ton with what I’m doing.

I was wondering if you have any ideas on limiting the type of characters? For instance only letters, no numbers or punctuation. Is there a way to be very specific with it? 

Any info is much appreciated. Regardless thanks for everything else in this thread

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.