Can someone please advise which file to edit to restrict the size of a custom field?

Vinay Shekar March 4, 2016

This question is in reference to Atlassian Documentation: How to Change the Size of Text Area Custom Field

How can we reduce the size of a custom field of type Text Field (Multi Line).

We need to restrict the size to 30 characters.

 

Thanks

Vinay

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 4, 2016

It may have moved between versions, but the file name has been consistent - look for edit-textarea.vm

Vinay Shekar March 4, 2016

Hi Nic,

 

If I am not wrong, we need to add below content in edit-textarea.vm file right?

 

#controlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters.noHeader)

#if ($!customField.id=="customfield_10220")
## setup some additional parameters
$!rendererParams.put("rows", "2")
$!rendererParams.put("cols", "40")
$!rendererParams.put("wrap", "virtual")

## let the renderer display the edit component
$rendererDescriptor.getEditVM($!value,
$!issue.key, $!fieldLayoutItem.rendererType, $!customField.id,
$!customField.name, $rendererParams, false)

#elseif ($!customField.isRenderable() && $rendererDescriptor)

## setup some additional parameters
$!rendererParams.put("rows", "2")
$!rendererParams.put("cols", "40")
$!rendererParams.put("wrap", "virtual")

## let the renderer display the edit component
$rendererDescriptor.getEditVM($!value,
$!issue.key, $!fieldLayoutItem.rendererType, $!customField.id,
$!customField.name, $rendererParams, false)

#else

<textarea name="$customField.id"
id="$customField.id"
class="textfield"
rows="4" cols="40" wrap="virtual"
>$textutils.htmlEncode($!value)</textarea>
#end

#controlFooter ($action $fieldLayoutItem.fieldDescription $displayParameters.noHeader)

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 4, 2016

That looks right to me

Vinay Shekar March 4, 2016

Where we need to specify the size of the field? ie 30 characters

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 4, 2016

Just add the html maxlength attribute

Vinay Shekar March 4, 2016

If you don't mind can you give the attribute and in which line to add it?

 

Regards

Vinay

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 4, 2016

Er, you need to understand the html changes you are making for yourself.

 

Suggest an answer

Log in or Sign up to answer