Подскажите, кто знает, как правильно добавить javascript для моментальной валидации внесенных данных в title?
I don’t know about the javascript validation. But I can tell the PHP validation. I’m pasting the code here.
<method id="DoCheckToWrite" _delta="define_if_not_exists">
<comment></comment>
<static>false</static>
<access>public</access>
<type>Overload-DBObject</type>
<code><![CDATA[ function DoCheckToWrite()
{
// Run standard iTop checks first
parent::DoCheckToWrite();
$class = 'FunctionalCI';//getting the class of current object
$oUDSearch = new DBObjectSearch($class);
$oUDSearch->AddCondition('name', $this->Get('name'), '=');
$oUDSearch->AddCondition('id', $this->GetKey(), '!=');
$oUDSet = new DBObjectSet($oUDSearch);
$count = $oUDSet->Count();
if ($count > 0)
{
//$this->m_aCheckIssues[] = Dict::Format('UI:FunctionlCI:Action:New:CI');
$this->m_aCheckIssues[] = $this->Get('name'). ' already exists.';
return;
}
}]]>
</code>
</method>
This function will work before inserting data in DB. This function might help you in your validation.