I have a select list and by default it's value is "Please select" but while displaying I want to display "Null" instead of " Please select ". I have attched the screenshots and the velocity file code. I am not sure what i am doing wrong ?
Screenshot while creating the issue
edit.vm -------- #customControlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams) <select class="select" name="$customField.id" id="$customField.id"> #foreach ($option in $configs.options) #if(!$option.disabled || $option.disabled == false || ($value && $value == $option.optionId.toString())) #if ($value && $value.equals($option.optionId.toString())) #set ($selected = ' selected="selected"') #else #set ($selected = '') #end #if ( $selected == $option.optionId.toString() ) <option selected="selected" value=$option.optionId.toString()>$option.toString()</option> #else <option value=$option.optionId.toString()>$option.toString()</option> #end #end #end </select> #customControlFooter ($action $customField.id $fieldLayoutItem.fieldDescription $displayParameters $auiparams)
view.vm -------- #if($value == 'Please select') || $option.equals("Please select")) #set ($value = 'Null') #else $value.toString() #end
Screenshot after submitting the issue
Community moderators have prevented the ability to post new answers.
This looks a little confused to me.
"Please select" should not appear on a "view" screen, unless you've deliberately added it as an option to the list of options, and someone has selected it. If that is the case, then do the simple thing - rename the option to "Null" and it'll all work fine. (Although, if your users are English speaking, and non-technical, I really would avoid using the word "null", it's not very helpful for non-techies)
If my assumption there is wrong, then I'd have to question why and how you've got "please select" appearing at all?
I also think your velocity may be faulty - $value *might* be a string (so == won't work on it), but you can check your java to confirm that.
Yes, "Please select" should not appear on a "view" screen even if you selected as an option.
I did add Please select as an option but if the user selects "Please select" I want to display null or n/a instead of "Please select".
I did also tried this condition
#if($value.
equals(
"Please select") || $option.equals("Please select"))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Um, that sounds immensely broken to me. "Please select" simply is not a sane option to have in your data - it's self-contradictory (even if you output "null", it's still wrong). Your data will actively contain "please select" implying the users have made an active choice to select "please select" as an option.
Can you explain exactly why you've done this - what are you trying to achieve? I can't think of a scenario where adding a "please select" option is a valid approach, but I'm not very imaginitive.
(I actually think I already know what you're trying to do, and there's a far better way to do it, but I don't want to chase the wrong answer if I'm guessing inaccurately)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The inbuilt select list consists of None value and we don't want that. We don't want to make that as a required field . we already have many projects in Jira and I don't want to remove none option in velocity file, which reflects entire jira instance projects. I want to develop a select list plugin without none option and also at the same point of time if the user doesn't select anything i want to display as N/a or null. I also want to increase the width of the select list in this plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that's roughly what I thought, but with a couple of extra tweaks.
First, you really do need to kill off "please select" as an option, it's pointless complexity and functionally useless.
Second, think through and decide what you actually want, because this statement is self-contradictory, you can do one or the other, but not both.
> want to develop a select list plugin without none option and also at the same point of time if the user doesn't select anything i want to display as N/a or null
Either you want to display something, or you don't. If you remove "none", then there's nothing TO display as NA/null/None/Please-select/etc. Decide whether you want:
Note that in both cases, I'm skipping the question of mandatory entry, as it's not important to the display, it's up to you to decide whether the users can skip it (although it sounds like you'll always set it)
Now, I understand you need to do this on a by-project basis, so you've got two approaches here as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nope, not confused about what you are trying to do. I'm confused about your approach - you seem to be making it hideously complex, breaking your data, and bodging around it.
The fix boils down to:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Recommended Learning For You
Level up your skills with Atlassian learning
Learning Path
Apply agile practices
Transform how you manage your work with agile practices, including kanban and scrum frameworks.
Learning Path
Configure agile boards for Jira projects
Learn how to create and configure agile Jira boards so you can plan, prioritize, and estimate upcoming work.
Jira Essentials with Agile Mindset
Suitable for beginners, this live instructor-led full-day course will set up your whole team to understand how to use Jira with an agile methodology.
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.