Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.
DISCLAIMER
All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.
Cireson does not and will not support or maintain these enhancements, extensions, and scripts.
For Team Cireson uploads click here.
Custom auto resizing of textareas in work item forms
To avoid this and get a smoother experience I made a custom solution which resizes textareas on form load and even so when typing into the text area.
As of now all text areas with a Description, Reason or Notes label in IR, SR, CR & PR general tab forms are auto resized but it's easy expandable.
Tested with IE11, Chrome 55, Firefox 45 & Edge.
I've attached the files needed in a zip archive. To install just drop the files in CustomSpace (merge custom.js if you have other stuff there already!)
Comments
Just thinking it would be possible for some folks to paste in long emails/strings of text with lots of spacing that could really make this super long and it would be nice to cap it at a certain amount before the scrollbar appears.
Default the max height is on and set to 300px. If you want another value change it in the top of the JS file:
I'm guessing here that you have RO where you need the ability to have more characters but don't want that big 10 rows textarea, otherwise you could adjust the RO textfields length.
There is the result for textarea not in general tab.
It will auto resize only when have input from keyboard.
Can anyone help to fix this ? i'm not really good in javascript
Will go over the code and make sure it works as intended when the time comes...
The code is looking for an input to remove the autoresize. For us, we were 'ok' with changing keyboard input to simply clicking within the text box. For us this kept for form/page clean, thus only expanding the field when a user clicks the field.
As Shown below, for line 89 on version 0.2, i changed from on 'keyup input' to click. Simply the box will resize when the field is clicked into.
$(this).on('click', function() { resizeTextarea(this); }).removeAttr('data-autoresize');
The user requirement here is to print the CR form with all details.
Thank you for hint on line89, will take a look into it and change it to reflect when page print or page load to fulfill customer requirement.
You can vote for this 'autoresize textbox' feature here:
https://community.cireson.com/discussion/1825/advanced-request-offering-set-text-box-sizes
The Hardware Asset form change was an easy one and v0.3 of the code now supports Hardware Asset description field.
However, I'm not sure what Business Service fields you are talking about as there are none, by default, that are free text fields.
If you have a specific field I can add it in if you need.
If you have created custom CI classes that you want to display in the new Configuration Item views, then each one will need to be added to the JS file with the appropriate CI ClassName.
You can find the class name by typing the following in the console of the browser:
pageForm.viewModel.ClassName
Happy to help anyone add these as custom additions to their environment if they need a hand.
Hi Brett,
Looking to add this to the Business Service class and extended strings.
I have added the following:
// ************ BUSINESS SERVICE FORM ************
app.custom.formTasks.add('BusinessService', null, function (formObj, viewModel) {
var hwaFormHookFunction = function() {
var pageElement = $('label[for="Description"]')
if (pageElement.length > 0) {
$(document).unbind("ajaxComplete", hwaFormHookFunction);
CustomResizeFormHandler();
}
}
$(document).bind("ajaxComplete", hwaFormHookFunction);
});
The description textbox becomes re-sizable but still defaults to maximum size.
Any help would be appreciated, thanks mate.