Is there a way to limit Character count of String type in user macros?

I want to limit Character count of String input type in a user macro i am creating. Is there a way to do this?

thank you in-advance for your time and attention. 

1 answer

1 accepted

1 vote
Stephen Deutsch Community Champion Jan 24, 2018

How is the string getting input? Do you mean in the macro options or do you have a text box on the page?

through Macro options

Stephen Deutsch Community Champion Jan 24, 2018

Unfortunately there doesn't seem to be any way to limit the macro options, but you could introduce an error message in the macro itself if the input is too long.

Is there a known code to display an error message? 

Stephen Deutsch Community Champion Jan 24, 2018

You could probably do something like this:

#if ($paraminput.length() > 10)
<div class="aui-message aui-message-error">
<p class="title">
<strong>Error</strong>
</p>
<p>Macro parameter "input" must be 10 characters or less!</p>
</div>
#else
... rest of code ...
#end

This example is taken from AUI, the Atlassian User Interface guidelines:

https://docs.atlassian.com/aui/7.6.2/docs/messages.html

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

328 views 18 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you