Моментальная валидация title тикета при создании через портал

Подскажите, кто знает, как правильно добавить 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">
          <code><![CDATA[  function DoCheckToWrite()
        // Run standard iTop checks first

        $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.';

This function will work before inserting data in DB. This function might help you in your validation.