@khumer If you want to handle validation of Text Input through its Change Event Handler (and using an independent search to perform complex validation as per your requirement), you should be able to get to your desired result directly through Simple XML without any JS. Please try the following run anywhere example. <form>
<label>Text Box Input validation</label>
<!-- Independent Search to perform strictly 9 digits input validation -->
<search>
<query>| makeresults
| fields - _time
| eval id="$id$"
| eval validationNumeric=case(isnum(id) AND NOT match(id,"\."),1,true(),0),
validationLength=case(len(id)=9,1,true(),0)
| eval validatedID=case(validationNumeric==1 AND validationLength==1,id,true(),"failed")
| eval validationMsg=case(validationNumeric==0 AND validationLength==0,"ID must be 9 digit number.",
validationNumeric==0,"ID must have only digits.",
validationLength==0,"ID must be 9 digits.",true(),"success")</query>
<earliest>-1s</earliest>
<latest>now</latest>
<progress>
<!-- Clear validation ID if input validation failes -->
<eval token="validatedID">case($result.validatedID$!="failed",$result.validatedID$)</eval>
<!-- Clear validation Msg if validation is successful -->
<eval token="validationMsg">case($result.validationMsg$!="success",$result.validationMsg$)</eval>
</progress>
</search>
<fieldset submitButton="false" autoRun="false"></fieldset>
<!-- Show Error in case of Input 9 digit validation failure -->
<row>
<panel>
<input type="text" token="id" searchWhenChanged="true">
<label>Enter Number (*9 digits)</label>
<change>
<!-- Every Time Input changes Validation ID and Message will be re-evaluated using Independent search. -->
<!-- So unset both -->
<unset token="validatedID"></unset>
<unset token="validationMsg"></unset>
</change>
<default>123456789</default>
</input>
<html depends="$validationMsg$">
<div>
<div>
<code>Validation Error: $validationMsg$</code>
</div>
</div>
</html>
</panel>
</row>
<!-- Run search only if Valid 9 digits are keyed in as input -->
<row depends="$validatedID$">
<panel>
<table>
<search depends="$validatedID$">
<query>| makeresults
| eval validatedID=$validatedID$
</query>
</search>
</table>
</panel>
</row>
</form>
... View more