I noticed in the latest version of iTop, upon creating a new user and selecting a contact from the first drop down - the 2 read only fields below (First name and email) loads automatically prior to the user actually being created, whereas before it would only appear once the user is saved.
I wish to apply the same methodology to another Configuration Item, can someone please help me find the code where this is implemented?
Kind regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the XML definition of the field, look for a tag named "dependencies" in the XML. (Looks like this is missing in the XML reference documentation!)
Example:
<fieldid="approver_id"xsi:type="AttributeExternalKey"><filter><![CDATA[SELECT Person WHERE org_id= :this->org_id]]></filter><dependencies><attributeid="org_id"/></dependencies><sql>approver_id</sql><target_class>Person</target_class><is_null_allowed>true</is_null_allowed><on_target_delete>DEL_MANUAL</on_target_delete><allow_target_creation>false</allow_target_creation><jointype/></field>
This tells iTop that the field "approver_id" depends on the value of the field "org_id", in this case this is needed because the possible values for "approver_id" are defined by an OQL query which contains - as a parameter - the value of the field org_id for the current object being edited.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am familiar with the above concept and i think this then leads onto my next question on how does one make a field read only as has occured under the user creation section?
If possible, i would also like to know where the script is located that allows for the data to be loaded instantly, whereas before this was not a possibility and the data only appeared after saving the CI.
Kind regards
Last edit: jitsobullet 2014-11-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Only objects which have a lifecycle (like tickets) can specify that a field is read-only (or hidden) via the XML data model.
However one can overload the method GetAttributeFlags(...) to alter this behavior and make a field read-only depending on any characteristics of the object.
About your second question: all asynchronous actions in iTop are called via the page: pages/ajax.render.php
Hope this helps
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I noticed in the latest version of iTop, upon creating a new user and selecting a contact from the first drop down - the 2 read only fields below (First name and email) loads automatically prior to the user actually being created, whereas before it would only appear once the user is saved.
I wish to apply the same methodology to another Configuration Item, can someone please help me find the code where this is implemented?
Kind regards
Up!
This is handled by the dependency between fields.
In the XML definition of the field, look for a tag named "dependencies" in the XML. (Looks like this is missing in the XML reference documentation!)
Example:
This tells iTop that the field "approver_id" depends on the value of the field "org_id", in this case this is needed because the possible values for "approver_id" are defined by an OQL query which contains - as a parameter - the value of the field org_id for the current object being edited.
Thanks Denis,
I am familiar with the above concept and i think this then leads onto my next question on how does one make a field read only as has occured under the user creation section?
If possible, i would also like to know where the script is located that allows for the data to be loaded instantly, whereas before this was not a possibility and the data only appeared after saving the CI.
Kind regards
Last edit: jitsobullet 2014-11-03
Only objects which have a lifecycle (like tickets) can specify that a field is read-only (or hidden) via the XML data model.
However one can overload the method GetAttributeFlags(...) to alter this behavior and make a field read-only depending on any characteristics of the object.
About your second question: all asynchronous actions in iTop are called via the page: pages/ajax.render.php
Hope this helps
Appreciate that Denis