Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Select List Plugin, User List to VM file - Error

Prateek Tandon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2012

I want to create a user select list plugin and i have managed to create the same and retrieve the user list to vm file but when i save the issue it gives an error saying "Invalid value 'xxxxxx' only ,-1 is allowed".How to handle it?

I have overrided the method getVelocityParams() present in the SelectCFType. But still I m struggling with the same .

Can any body help me in resolving the issue.

I have also one problem please also tell me How to store the value in the databse for the same plugin?

Thanks in advance

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2012

I'm not clear on what you are trying to do here, but it sounds like you've created a select list, presented the user with a list of options, they select one and then it refuses to save it because the option they have selected is not a valid option for the select list? If you think about it, that does make sense - select lists work from a list of known options, if there are none, you can't tell them to save it. You either need to provide the options for the select list, OR swap to using a field type that does not need pre-set options (text, date, number of user fields for example)

Prateek Tandon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2012

<select class="select" name="$customField.id" id="$customField.id">

#foreach ($option in $options)

#if($value && $value == $option.userName)

<option#if ($value && $value == $option.id.toString()) selected="selected"#end value="$option.id">$option.displayName</option>

#end

#end

</select>

I m doing like this. This is giving me the options correct but as I click on CreateIssue button the error is thrown as "Invalid value '1000' passed. Allowed values are ,-1".

Please help me in this.

I want one help also i.e. How to store the select value in the databse. And in which table it is stored.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2012

The table is CustomFieldValue. But as Nic suggested, did you check if there is a user with id 1000? Shouldn't it be the username for a user that you are saving?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 20, 2012

Your code doesn't do anything about the list of options that the select list has to validate against.

As well as the user ID check, I suspect that you might be using the wrong type of field - a select list needs valid *options*. Is your value of 1000 on the list of options you've set up for your custom select list? If not, then this error is correct.

This is why I suggested using a different base - I think you need a field type that does NOT have a list of options.

Think of it this way - you have a field called "colour", which has options of "red", "blue" and "yellow". Your javascript is saying "set the value to green". Of course it chokes when you try to save it - green is not on the option list.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events