Jump to content

pigeon8

Member
  • Posts

    3
  • Joined

  • Last visited

Posts posted by pigeon8

  1. On 8/29/2020 at 12:54 PM, paul2009 said:

    All you need is a line of JavaScript that identifies the form field that you want to affect, and then adds the following HTML to the input control: maxlength="300".

    If someone posts a link to their form and specifies the form field that they want to restrict, one of us can post some code 🙂

     If this helps you, please click "Like" below  ⬇️

    Hi Paul,

    Thanks so much for the offer to help. My site isn't public yet so I can't post the link unfortunately. After reading your post I found the textarea id by inspecting element on the form (a product pop up form). I then pasted the below code into the header and footer sections within "code injection" but it hasn't worked:

    <script>
      document.getElementById("textarea-yui_3_17_2_1_1594284193900_17624-field").setAttribute("maxlength",5) 
    </script>

    Are you able to help?

  2. I have the same issue. If you could edit the html it would actually be as simple as setting the maxlength parameter of the textarea. Instead I think it may be possible to do it in a roundabout way using javascript in a code injection to run a custom validation on the length that was entered. Link below where this is discussed for some different use cases. I can sort of hack may way through issues like this sometimes so will update if I get to a working solution...

     

×
×
  • 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.