Hi,
I am facing an unusual problem right now related to Behaviours(Script Runner) plugin. I need to display an info or so called warning at the top of the transition screen. I already tried to use Behaviours validator which looks like this:
FormField field = getFieldById("customfield_XXXXX"); field.setHelpText("My warning message !!!");
The problem is it displays an info below the form field which does not satisfy me. I had an idea which corresponds to Script Runner's 'Custom Validator Script'. It can throw InvalidInputException. I remember that InvalidInputException can be instantiated with 'field name' and 'error message' so it's 'error message' is displayed below the field. BUT if you pass only 'error Message' it will be shown at the top of the screen.
My questions are: Is there a way to display some message at top (above all screen fields) of the screen and if so, how to do it in groovy ? Am i thinking right to use InvalidInputException ?
Thanks,
Tom
Use a workflow validator if you want to do this, don't use behaviours. If you use a validator then yes you throw an InvalidInputException.
The problem is if i use workflow validator the message will be shown after user clicks button to close (validate form) screen. And i need the message to be shown straightaway the transition screen apprears.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's true. I would just put the message under the summary... currently behaviours doesn't have support for sticking the message at the top.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Jamie. Now i'll try non proffesional way :) : put some javascript as help text (setHelpText()) with Behaviours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did it with help of jquery:
image2014-11-26 10:32:26.png
And with this code used as Behaviours validator script:
FormField assignee = getFieldById("assignee"); String js = "<script>\n"+ "AJS.\$(document).ready(function(){\n"+ "AJS.\$(\"#assignee-container\").before(\"<div id=\\\"title-container\\\"><span>This transition is for authorized users only !</span></div>\");\n"+ "AJS.\$(\"#title-container span\").css(\"color\",\"red\");\n"+ "AJS.\$(\"#title-container\").css(\"text-align\",\"center\");\n"+ "AJS.\$(\"#title-container\").css(\"border\",\"1px solid red\");\n"+ "});\n"+ "</script>"; assignee.setHelpText(js);
Edit:
Too fast... Now Behaviours can not let me pass the transition and every time i try to close the screen it shows alert:
image2014-11-26 10:54:28.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's pretty cool, although horribly unmaintainable ;-) Can't help thinking you just need a condition though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea why Behaviours keeps showing this alert ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This happens if you try to submit when it's in the process of sending a request. Try putting the behaviour not on the assignee, but on some field that's not likely to change. I think you can put it on the project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.