I want to validate input (text) which i have to check with databse record is exist.
the code something like that:-
i have try this. but stil update the value even the record is exist.
the code something like that:-
Code:
<cfscript>
function checkkp() {
if (rscheck.recordcount NEQ 0) {
writeoutput("Rekod telah wujud");
return false;
}
}
</cfscript>
<cfif isdefined("form.tnokp") and #from.tnokp# EQ "">
<cfquery name="rscheck" datasource="tryxx">
SELECT *
FROM dbo.oxy
WHERE NoKP = '#Form.tnokp#'</cfquery>
</cfif>
....
<input name="tnokp" type="text" id="tnokp" onchange="checkkp(this.value)" value="<cfoutput>#rsKemas.NoKP#</cfoutput>" size="16" maxlength="12" />
Comment