Setting an attribute value from script
Hello Guys, I am trying to make few fields read only based on condition. I can do it by settting up 'Operational Behaviour' in the project area. Apart from this, before settting up the values read only, i should also be able to set the value to zero. Is it possible to set the value from a js script before setting it to read only. Belwo is the script.
dojo.provide("net.jazz.example.readonly.Condition");
if (dropdownvalue=="inex.literal.l4")
Thanks..Johnson
|
3 answers
multiple attribute customization can be applied on attributes.
along with your condition, you may want to use default value attribute customization to set the default. Comments hi Johnson, feel free to comment the suggestion to use default values did not address your concern. based on your comments, it might give more clarity and others might have more suggestions to provide... if it has helped, you can mark the question as answered by accepting the answer.
Johnson David
commented Aug 01 '13, 8:58 a.m.
Hello Dinesh, Thank you so much for showing interest!! Here is the situation right now!! I have a dropdown that has Include & Exclude options .Below it has two fields which are depended on the dropdowns values When the user chooses Include , the below two fields should be editable & mandatory When the user chooses Exclude, the below two fields should become ready only
In another scenario, If the user had entered values in fields, and then the users change the dropdown
The script i pasted in my question, can only make the fields read only & editable depending on the dropdwon value (the script is based on condition & operational behaviour section has been configured to deal with it) but cannot make the fields zero before read only is applied And also i need the fields mandatory when the use chooses Include option from the dropdown Can we accomidate all the above scenarios in a single script ?
Not sure default values can address the concern ?
|
you will not be able to do this with a single routine. you 'might' be able to code multiple functions in a single script file, but RTC has discreet function requests for each action, so you will have to register each separately
default value current value changeable or not |
I would agree with Sam and I would doubt if everything can be done in a single script. As per my understanding here is what I think:
One part is already taken care by your script. To make the attributes mandatory, in the Attribute Customization section you can add a script based Validation which will check if the attribute values are null and then add Attribute Validation precondition from the Operation Behavior section. ( you can find further help in https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Script_Based_Validation) Now, your comment "In another scenario...." is something sounds contradictory to me. On one hand you are saying that if the value is Exclude then the other attributes will be "readonly" whereas you are trying to change or set the value to 0. May be something to think of if a different approach is easier; however, you can try this with Script based Calculated Values. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.