I want to call a javascript function if my cfif logic is True. How do I call the javascript function? I just want to have a popup alert saying that the choice already exists, and then send the user back to the main page.
[code=cfm]
<cfif isDefined("Form .Add")>
<cfquery name="validateN ame" datasource="Sec urity_Access" dbtype="ODBC">
select sysID from tblSystem
where name='#Form.nam e#'
</cfquery>
<cfif "validateName.R ecordCount" eq 1>
<cfoutput>sysEx ists(#Form.name #)</cfoutput>
<cflocation URL="system.cfm ">
<cfelse>
<cfquery name="insertSys tem" datasource="Sec urity_Access" dbtype="ODBC">
insert into tblSystem (name,descripti on,updDateTime)
values ('#name#','#des cription#','#Da teTime#')
</cfquery>
</cfif>
</cfif>
[/code]
[code=cfm]
<cfif isDefined("Form .Add")>
<cfquery name="validateN ame" datasource="Sec urity_Access" dbtype="ODBC">
select sysID from tblSystem
where name='#Form.nam e#'
</cfquery>
<cfif "validateName.R ecordCount" eq 1>
<cfoutput>sysEx ists(#Form.name #)</cfoutput>
<cflocation URL="system.cfm ">
<cfelse>
<cfquery name="insertSys tem" datasource="Sec urity_Access" dbtype="ODBC">
insert into tblSystem (name,descripti on,updDateTime)
values ('#name#','#des cription#','#Da teTime#')
</cfquery>
</cfif>
</cfif>
[/code]
Comment