Comments on: Add character or word count to SharePoint multi line plain text field and restrict input length http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/ No GeekSpeak on SharePoint 2007 WSS and MOSS Fri, 22 Apr 2011 21:46:47 -0500 http://wordpress.org/?v=2.8.6 hourly 1 By: mswin http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-151075 mswin Wed, 13 Apr 2011 21:30:25 +0000 http://www.endusersharepoint.com/?p=7045#comment-151075 Hi Alex, now I am confirmed that its due to Rich text field. I am not able to download the script from the below link. http://sharepointjavascript.wordpress.com/2010/05/28/get-or-set-value-for-sharepoint-field-in-newform-editform-and-dispform-get-only-in-dispform/ Is there any alternate location from where I can download the js file mentioned there to getFieldvalue script. Thanks. Hi Alex,

now I am confirmed that its due to Rich text field.
I am not able to download the script from the below link.
http://sharepointjavascript.wordpress.com/2010/05/28/get-or-set-value-for-sharepoint-field-in-newform-editform-and-dispform-get-only-in-dispform/

Is there any alternate location from where I can download the js file mentioned there to getFieldvalue script.

Thanks.

]]>
By: Alexander Bautz http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-151057 Alexander Bautz Wed, 13 Apr 2011 18:56:46 +0000 http://www.endusersharepoint.com/?p=7045#comment-151057 Again this code does work, but I'm starting to think you use a rich text field? The code examples you provide works for plain text only (in IE). To have this work in a rich text field is harder as the field is not a textarea, but a editable div in an iframe. The textarea is hidden and as you have figured out, does not update on PreSaveAction. <a href="http://sharepointjavascript.wordpress.com/2010/05/28/get-or-set-value-for-sharepoint-field-in-newform-editform-and-dispform-get-only-in-dispform/" rel="nofollow">Look her for further help</a> Alexander Again this code does work, but I’m starting to think you use a rich text field? The code examples you provide works for plain text only (in IE).

To have this work in a rich text field is harder as the field is not a textarea, but a editable div in an iframe. The textarea is hidden and as you have figured out, does not update on PreSaveAction.

Look her for further help

Alexander

]]>
By: mswin http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-150999 mswin Wed, 13 Apr 2011 14:10:24 +0000 http://www.endusersharepoint.com/?p=7045#comment-150999 Hi, Thank you for the reply. I plcaed it inside the CEWP without document.ready function, but still I did not get it working. The thing that I am trying out is I would like to validate the text area field in presave function, to show validation message.None of the below gives me the user inputted text on presave ,and it always gives me the value the text area has when the page loads. function PreSaveAction() { alert($("textarea[title$='Reason']").text()); alert($("textarea[title$='Reason']").val()); alert($("textarea[title$='Reason']").html()); return false; } The scenario is, if the text area is empty while the page loads, it always gives me the empty value even though the user inputted some text in presave action. So, I have thought if using keyup function to determine that it has value or not. Now, for some reason none of this works on my list form. Any suggestions/help on getting it done. Many thanks. Hi,

Thank you for the reply.

I plcaed it inside the CEWP without document.ready function, but still I did not get it working.

The thing that I am trying out is I would like to validate the text area field in presave function, to show validation message.None of the below gives me the user inputted text on presave ,and it always gives me the value the text area has when the page loads.

function PreSaveAction()
{

alert($(”textarea[title$='Reason']“).text());
alert($(”textarea[title$='Reason']“).val());
alert($(”textarea[title$='Reason']“).html());

return false;
}

The scenario is, if the text area is empty while the page loads, it always gives me the empty value even though the user inputted some text in presave action.
So, I have thought if using keyup function to determine that it has value or not.

Now, for some reason none of this works on my list form.

Any suggestions/help on getting it done.

Many thanks.

]]>
By: Alexander Bautz http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-150913 Alexander Bautz Wed, 13 Apr 2011 07:50:43 +0000 http://www.endusersharepoint.com/?p=7045#comment-150913 Hi, I tested your code example and it works. I did not wrap it in document.ready, but placed the CEWP below the form. Please check your field name - and beware that the double quotes are corrupted when copying from the web - you must rewrite them. Alexander Hi,
I tested your code example and it works. I did not wrap it in document.ready, but placed the CEWP below the form.

Please check your field name – and beware that the double quotes are corrupted when copying from the web – you must rewrite them.

Alexander

]]>
By: mswin http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-150773 mswin Tue, 12 Apr 2011 14:24:56 +0000 http://www.endusersharepoint.com/?p=7045#comment-150773 Hi, I want to validate text area field value on the list form. This field is a required field when the user chooses one of the choice from a dropdown field. I am using the below code inside document.ready function, but for some reason keyup event won't fire up on Sharepoint list Edit form. $("textarea[title$='Reason']").keyup(function() { var len = this.value.length; alert("Text Length: " + len); if (len > 0) { isValid = true; } else { isValid = false; } }); Is there anything I am missing here? Can please someone help getting it work. Thanks. Hi,

I want to validate text area field value on the list form. This field is a required field when the user chooses one of the choice from a dropdown field.
I am using the below code inside document.ready function, but for some reason keyup event won’t fire up on Sharepoint list Edit form.

$(”textarea[title$='Reason']“).keyup(function() {

var len = this.value.length;
alert(”Text Length: ” + len);
if (len > 0) {
isValid = true;

}
else
{
isValid = false;

}

});

Is there anything I am missing here? Can please someone help getting it work.

Thanks.

]]>
By: rachel http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-145993 rachel Tue, 22 Mar 2011 17:42:01 +0000 http://www.endusersharepoint.com/?p=7045#comment-145993 If I want to limit the charater to 255, do I just change the code counterForMultiLinePlain('MyMultiline',true,50,true,'Remaining words: '); from 50 to 255? I tried, but it seems it counts one line as one character. Did I miss anything? If I want to limit the charater to 255, do I just change the code

counterForMultiLinePlain(’MyMultiline’,true,50,true,’Remaining words: ‘);

from 50 to 255?

I tried, but it seems it counts one line as one character. Did I miss anything?

]]>
By: John Brooks http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-145256 John Brooks Sat, 19 Mar 2011 06:19:25 +0000 http://www.endusersharepoint.com/?p=7045#comment-145256 Does any have the CEWP code to increase the width of a multiline enhanced text box? Thanks for your Help. Does any have the CEWP code to increase the width of a multiline enhanced text box?
Thanks for your Help.

]]>
By: Snehal H.Rana http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-127084 Snehal H.Rana Fri, 14 Jan 2011 17:19:54 +0000 http://www.endusersharepoint.com/?p=7045#comment-127084 How do I apply this to multiple plain text fields on the same form? Is it possible? I have total of 4 fields on the same newform.aspx and need to do the same for remaining 3 fields. How do I place the word "Remaining words: " right underneath the field it is tied to? Right now it appears above the field. How do I apply this to multiple plain text fields on the same form? Is it possible? I have total of 4 fields on the same newform.aspx and need to do the same for remaining 3 fields.

How do I place the word “Remaining words: ” right underneath the field it is tied to? Right now it appears above the field.

]]>
By: Snehal H.Rana http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-126719 Snehal H.Rana Thu, 13 Jan 2011 17:32:46 +0000 http://www.endusersharepoint.com/?p=7045#comment-126719 Animesh, I don't believe you need to add CEWP below the multiline. Since the code has the refernce to the field, this CEWP can be in Web Part Zone right below the main zone. Just my 2c Animesh,

I don’t believe you need to add CEWP below the multiline. Since the code has the refernce to the field, this CEWP can be in Web Part Zone right below the main zone.

Just my 2c

]]>
By: Lee http://www.endusersharepoint.com/2010/04/02/add-character-or-word-count-to-sharepoint-multi-line-plain-text-field-and-restrict-input-length/comment-page-1/#comment-70348 Lee Wed, 26 May 2010 08:47:33 +0000 http://www.endusersharepoint.com/?p=7045#comment-70348 Another wonderful tool for me! Everything just work fine except one situation that I met. If the word count reached limit, and the OK button is grey out. Even I reduced the number of words, the OK button will not be undimmed. Is there a way to fix this? Another wonderful tool for me! Everything just work fine except one situation that I met.

If the word count reached limit, and the OK button is grey out. Even I reduced the number of words, the OK button will not be undimmed.

Is there a way to fix this?

]]>