Jump to content

Georgiawhoknows

Member
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Georgiawhoknows

  1. Thank you so much it worked! 🙂 I really appreciate your help Thomas! 🙂 Best of luck with everything! You are amazing!
  2. Dear Thomas! I have tried using your code but it doesn't seem to be working. Do you know what could be an issue? Thank you for your help. Kind regards, Georgia <script> $( ( ) => { /* set store product detail named form labeled text field character max length Version : 0.2d0 SS Versions : 7.0, 7.1 v7.0 Templates : Brine ( Aria, Blend, Burke, Cacao, Clay, Fairfield, Feed, Foster, Greenwich, Hatch, Heights, Hunter, Hyde, Impact, Jaunt, Juke, Keene, Kin, Lincoln, Maple, Margot, Marta, Mentor, Mercer, Miller, Mojave, Moksha, Motto, Nueva, Pedro, Pursuit, Rally, Rover, Royce, Sofia, Sonora, Stella, Thorne, Vow, Wav, West ) your template is not listed? then it is not currently supported Dependancies : jQuery twcsl Notes : this code is for forms added as part of the product editor : Classic Editor > Form or New Editor > Customize > Custom Forms it is not for forms added through : Classic Editor > Additional Info or New Editor > Customize > Additional Info a text form field is either a text or text area field By : Thomas Creedon < http://www.tomsWeb.consulting/ > */ /* 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 = 'Gift message'; const maxLength = 80; /* for formFieldLabel copy the value from the form Text Area field editor LABEL field. you only need exactly what can be selected from the field */ const formFieldLabel = 'Gift message'; // do not change anything below, there be the borg here if ( ! twcsl.storePage.isDetail ) return; // bail if not detail // bail if no mutation observer available if ( ! ( 'MutationObserver' in window ) ) return; // begin get form field text labeled var getFormFieldTextLabeled = ( label, $form ) => { let $it = undefined; $( '.text, .textarea', $form ).each ( function ( ) { const $this = $( this ); const title = twcsl.getFormFieldLabel ( $this ); if ( title != label ) return true; // continue if not our field $it = $( 'input, textarea', $this ); return false; } ); return $it; } // end get form field text labeled const observer = new MutationObserver ( function ( mutations ) { $.each ( mutations, function ( ) { if ( ! this.addedNodes.length ) return; let $element = $( this.addedNodes [ 0 ] ); if ( ! $element.hasClass ( 'sqs-modal-lightbox' ) ) return; if ( $( '.form-title', $element ).text ( ) != formName ) return; const $form = $( 'form', $element ); const $text = getFormFieldTextLabeled ( formFieldLabel, $form ); if ( $text === undefined ) return true; // continue if no element $text.attr ( 'maxLength', maxLength ); } ); } ); // start listening for changes in body observer.observe ( document.body, { childList : true } ); } ); </script>
  3. Dear Thomas! Would it be possible for you to create a code for 80 characters gift message? You can find a form here https://www.glassitude.com/shop/p/sea-turtle-glass-straw and you just need to add a product to the basket in order for the form to pop up. Thank you so much for your help and time. Kind regards, Georgia
  4. Dear @Creedon, Can I kindly ask you for your help? I have created a gift form where I allow people to leave a gift message but it has to be maximum 80 characters can you please help me with the code? Website www.glassitude.com Gift form is set up at the check out. Website password Seaside. Thank you for your help and time. Kind regards, Georgia
×
×
  • 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.