Hi folks,
I am struggling to make the status field for the PC class required. I have made sure the extension xml has for this field is stating null is not allowed. I have also changed the values.
<field id="user-content-status" xsi:type="AttributeEnum" _delta="redefine"> <values> <value>Deommissioned</value> <value>Delete</value> <value>Deployed</value> <value>Disposed</value> <value>In Inventory</value> <value>In Transit</value> <value>Ordered</value> <value>Reserved</value> <value>Return to IT</value> </values> <sql>status</sql> <default_value></default_value> <is_null_allowed>false</is_null_allowed></field>
I am not sure beyond not allowing null how to make the field required in the GUI.
Also can I make the default blank? Thus forcing the user to make a selection and not just saving it with a default?
Thanks
Greg
maybe <mandatory> or <must_prompt> in the attributes will help?</must_prompt></mandatory>
eg.:
<states> <state id="new"> <flags> <attribute id="ref"> <read_only/> <must_prompt/> <mandatory/> </attribute> </flags> </state> </states>
The issue is that the parent class Physical Device needs to have it's null allowed value set to false.
It is not sufficient to simply change the pc class. It does not overwrite the parent class.
Hmm, in this case you'll have to write a little bit of PHP code:
Overload the method GetAttributeFlags(...) for the class PC and return the constant OPT_ATT_MADATORY if $sAttCode == 'status'
It works now by having the parent class status field set to not allow null.
Log in to post a comment.
Hi folks,
I am struggling to make the status field for the PC class required. I have made sure the extension xml has for this field is stating null is not allowed. I have also changed the values.
<field id="user-content-status" xsi:type="AttributeEnum" _delta="redefine">
<values>
<value>Deommissioned</value>
<value>Delete</value>
<value>Deployed</value>
<value>Disposed</value>
<value>In Inventory</value>
<value>In Transit</value>
<value>Ordered</value>
<value>Reserved</value>
<value>Return to IT</value>
</values>
<sql>status</sql>
<default_value></default_value>
<is_null_allowed>false</is_null_allowed></field>
I am not sure beyond not allowing null how to make the field required in the GUI.
Also can I make the default blank? Thus forcing the user to make a selection and not just saving it with a default?
Thanks
Greg
maybe <mandatory> or <must_prompt> in the attributes will help?</must_prompt></mandatory>
eg.:
Last edit: slade 2015-01-06
The issue is that the parent class Physical Device needs to have it's null allowed value set to false.
It is not sufficient to simply change the pc class. It does not overwrite the parent class.
Hmm, in this case you'll have to write a little bit of PHP code:
Overload the method GetAttributeFlags(...) for the class PC and return the constant OPT_ATT_MADATORY if $sAttCode == 'status'
It works now by having the parent class status field set to not allow null.