I am using behaviours plugin to add behaviour to 2 fields consider A and B .
A is a multiple select version picker customfield and B is a single select version picker customfield.
I have modified this script to add options to A and B based on each other .
when options in A are selected option in B are automatically prepopulated
However even before i select the a option in A , the behaviour occurs and i see only "None" as the option while B is a verion picker i should be able to see the versions of the project.
Similary while i select B i am trying to prepopulate value in A but that is not happening because i cant see any option in B other than "None"
And even after i remove the option from A i am able to see the corresponding values in B , It should get removed when option is removed.
How to tackle this ?
is there something i am missing ?
Community moderators have prevented the ability to post new answers.
All of the server-side scripts fire the first time the form is loaded, this is by design.
If you want all options to be available if A and B are uninitialised then you need to code that in. So only restrict the values of B if A is set. And vice versa.
I figured it out . i added a return statement in my code if no value is selected
FormField formComponent = getFieldById(fieldChanged)
FormField formSubcomponent = getFieldByName("B")
Object componentFormValue = formComponent.getFormValue()
if(!componentFormValue)
{
return;
}
How to set an option to a multi select version picker ? in the logs i see the values are perfect but the field disappeaars when i select a value from other field
i use below for setting values for single select and multiselect version picker . for single select its working fine .
Map fieldOptions = [:]
fieldOptions.put(vid.toString(), vname)
formSubcomponent.setFieldOptions (fieldOptions)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you want to set the value (setFormValue()) or set the available options (.setFieldOptions()) for the multi-version picker?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i want to set the available options (.setFieldOptions()) for the multi-version picker.
And how to clear the values in the fields when i unselect or make the field empty again ? because now when i unselect the option i am able to see the values until i select another option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i found that the format in which a single version picker values and multi version picker values are saved is different. a single version requires
fieldOptions.put(vid.toString(), vname)
formSubcomponent.setFieldOptions (fieldOptions)
to set the value.
while, a mulitiversion picker requires only the version id
formSubcomponent.setFormValue(vid.toString())
Now only have to remove values from dependant fields when options in a multi version picker are cleared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When i set value to a multiselect version picke using setFormValue() it sets the value perfectly but when i try to set the options of the multiselect version picker using setFieldOptions() the field disappears however when i view the source of the page from the browser i see the options in the field. why the field is not visible ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sounds like a bug, can you report one please... The fact that you see it in the source doesn't mean much, the javascript manipulates the dom, such that it might have little resemblance to the source.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok , i need to set the multiversion picker options because i cant let it display all the versions of the project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie ,
What might be the reason for this behaviour ? i wish this bug gets resolved soon .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.