PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Maxlength for Paragraph Text Fields

  1. blafarmm
    Member

    I noticed that 1.4 will offer a Maxlength Single Line Text input field.

    Many of us need this functionality for Paragraph Text fields.

    Any chance of adding this feature?

    Thanks

    Posted 13 years ago on Sunday August 29, 2010 | Permalink
  2. blafarmm
    Member

    If I may add one more item ...

    I had the technique described in the link pasted directly below working just fine before loading 1.3.13.1.

    http://forum.gravityhelp.com/topic/limit-characters-in-paragraph-text-field

    It could very well be "operator error" on my part -- but it does not seem to work anymore.

    I've uploaded the "limit-textarea.js" to Thesis 1.7 "scripts" directory -- and, just in case, to the Thesis 1.7 root directory as well.

    And, after inspecting my Paragraph Text field which is identified as <textarea id="input_95_739" class=textarea medium ...

    I've pasted this script in my Thesis "Document Head > Additional Scripts" field:

    <script src="<?php bloginfo('template_directory'); ?>/js/limit-textarea.js"></script>
    <script type="text/javascript">
    jQuery(document).ready(function() {
     		jQuery("#input_95_739").attr("maxlength", "250");
     		jQuery("#input_95_739").attr("onkeyup", "return ismaxlength(this)");
    	});
    </script>

    Have I made a stupid mistake -- or is this not working anymore?

    Thanks

    Posted 13 years ago on Sunday August 29, 2010 | Permalink
  3. I'm pretty sure the following won't work adding it via the thesis field.

    <?php bloginfo('template_directory'); ?>

    You will most likely need to replace that with the actual path to the .js file. Give that a go and see if it works for you.

    Posted 13 years ago on Sunday August 29, 2010 | Permalink
  4. blafarmm
    Member

    Hi Kevin,

    Thanks for that suggestion.

    Unfortunately, it did not work -- but I could have easily made a mistake.

    Here's what I did:

    I copied the .js file to my Thesis 17 root directory and I modified the script as follows:

    <script src="<?php bloginfo('http://MYDOMAIN.info/public_html/wordpress/wp-content/themes/thesis_17/'); ?>/js/limit-textarea.js"></script>
    <script type="text/javascript">
    jQuery(document).ready(function() {
     		jQuery("#input_95_739").attr("maxlength", "250");
     		jQuery("#input_95_739").attr("onkeyup", "return ismaxlength(this)");
    	});
    </script>

    I'm not sure if my syntax is correct, but it does not seem to work.

    Also, the last time I did this -- and it worked just fine -- I never had to define or modify the path to the .js file. I'm not sure what's different.

    Two Questions:

    1. Do you have any other suggestions regarding how I can get this to work?

    2. Can you tell me if a Maxlength function can/will be applied to Paragraph Text fields?

    Thanks very much.

    Posted 13 years ago on Monday August 30, 2010 | Permalink
  5. blafarmm,

    Try changing the path to:

    <script src="http://MYDOMAIN.info/public_html/wordpress/wp-content/themes/thesis_17/js/limit-textarea.js"></script>

    I hope that will work for you.

    Luke

    Posted 13 years ago on Monday August 30, 2010 | Permalink
  6. blafarmm
    Member

    Thanks rochestercitypages.

    Unfortunately, that didn't work either.

    For the record, I used both the single quote ' from the original script -- as well as the double quotes " you used in your example.

    I didn't use the "js" directory from you example -- as Thesis does not have one. But I did path the script to both the Thesis root directory -- as well as the Thesis "/lib/scripts" directory.

    And, no dice. Not sure why this worked so easily a month ago -- and not now.

    Posted 13 years ago on Monday August 30, 2010 | Permalink
  7. blafarmm,

    Then if your using thesis you need to add the js into the custom folder. Thats what I do and it works fine.

    http://MYDOMAIN.info/public_html/wordpress/wp-content/themes/thesis_17/custom/js/limit-textarea.js

    You don't wanna mess with the core of Thesis...put everything in the custom folder that way it down the road you wont have to worry about trying to figure this out again.

    Luke

    Posted 13 years ago on Monday August 30, 2010 | Permalink
  8. blafarmm
    Member

    It definitely makes sense to keep files in the Custom folder -- especially when updates roll-out. Thanks for the reminder.

    I created a "js" folder in the "custom" directory (as there was none) and copied "limit-textarea.js" file to it.

    And, here's exactly what I pasted into my "Thesis Site Options > Additional Scripts":

    <script src="http://MYDOMAIN.info/public_html/wordpress/wp-content/themes/thesis_17/custom/js/limit-textarea.js"></script>
    <script type="text/javascript">
    jQuery(document).ready(function() {
     		jQuery("#input_96_739").attr("maxlength", "250");
     		jQuery("#input_96_739").attr("onkeyup", "return ismaxlength(this)");
    	});
    </script>

    I've cleared the cache in my browser -- and it still does not work.

    Not sure what's going on here -- but I appreciate the help.

    Posted 13 years ago on Monday August 30, 2010 | Permalink
  9. We are having the same problem as blfarmm. We are on Thesis 1.7 and did everything you mentioned above. Created a js folder in the custom direct and copied the limit-textarea.js file to it.

    We are testing the Gravity form at http://ignitephoenix.com/dev/gravity-testing-page/. Here's exactly what are script looks like:

    <script src="<?php bloginfo('http://ignitephoenix.com/public_html/wordpress/wp-content/themes/thesis_17/custom/js/limit-textarea.js'); ?>/js/limit-textarea.js"></script>
    <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery("#input_1_6").attr("maxlength", "350");
    jQuery("#input_1_6").attr("onkeyup", "return ismaxlength(this)");
    });
    {
    jQuery("#input_1_8").attr("maxlength", "350");
    jQuery("#input_1_8").attr("onkeyup", "return ismaxlength(this)");
    });
    </script>
    Posted 13 years ago on Friday September 3, 2010 | Permalink
  10. Okay guys, I've got this working on Thesis 1.7 and here's the how-to.

    First, I created a "js" folder inside the custom folder and uploaded the limit-textarea.js file into that directory.

    screenshot

    Then, I went to the Thesis Site Options page and added the following to the Document Head > additional scripts section.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
    <script src="/wp-content/themes/thesis_17/custom/js/limit-textarea.js"></script>
    <script type="text/javascript">
    jQuery(document).ready(function() {
     		jQuery(".limit150 .textarea").attr("maxlength", "150");
     		jQuery(".limit150 .textarea").attr("onkeyup", "return ismaxlength(this)");
    	});
    </script>

    screenshot

    Notice that I included a link to the jQuery library there.. if you're already loading jQuery somewhere, you probably don't need that. There is a relative path to the js file so you shouldn't have to change that unless you put the file in another directory.

    Once that's done, you then need to go to the form admin. Navigate to the textarea that you want to apply the limit to, then under the advanced tab, add the class name "limit150"

    screenshot

    Save the form, go to your form page, refresh it and it should be working for you. You can apply the class to any textarea you'd like to limit. Of course, you can tweak the jQuery statement to change the limit number, the class name or whatever you like to suit your application.

    Posted 13 years ago on Friday September 3, 2010 | Permalink
  11. Kevin - This worked for us. Thanks so much for your help.

    Cheers,
    Michael

    Posted 13 years ago on Sunday September 5, 2010 | Permalink
  12. Great news. Thanks for the update.

    Posted 13 years ago on Sunday September 5, 2010 | Permalink
  13. blafarmm
    Member

    Kevin,

    It may be "operator error" on my part -- but this "fix" is not working for me.

    Even worse, the formating of my Gravity forms that are embedded in Thesis 1.7 pages is completely screwed up -- even without the textarea approach.

    In short, my checkbox "boxes" are all over the place in Firefox, IE and Chrome -- and this is on multiple sites.

    I'm not quite sure what's going on here -- but I've emailed you several times with a description of the problem.

    I'm in a bit of a bind -- so I'm hoping there is a quick solution I can apply to this pressing problem. And afterward, maybe you can find fault in my implementation of the textarea fix you suggested.

    Thanks very much.

    Posted 13 years ago on Wednesday October 6, 2010 | Permalink
  14. @blafarmm - I emailed you back. Your earlier message ended up in my spam folder.

    As I mentioned there, this isn't really a form support issue, but a customization. I've tested this script in Thesis 1.7 and it worked fine. Since you're having implementation problems, you may need to get in touch with the Thesis support for some guidance... I'm not sure . Or as I mentioned in the email as well, maybe you can reach out to an experienced developer to help get it going for you.

    Posted 13 years ago on Wednesday October 6, 2010 | Permalink