View Full Version : I've looked everywhere...

06-14-2007, 11:25 PM
Very new to JavaScript but need to get this done for work... No matter what I do, this if/else statement always runs completely through! It even bypasses the break. I'm not sure what I'm doing wrong, and I've compared it to many other people's samples of if/else's... Any help would be great!

if (form.ldap.checked)
{<cfset LDAPstatus = false>
<cfset QRY_updateSysObjectValueLDAP = objAdmin.updateSysObjectValue("0", 'LDAP/AD') />
<cfset LDAPstatus = true>
<cfset QRY_updateSysObjectValueLDAP = objAdmin.updateSysObjectValue("1", 'LDAP/AD') />
<!--- Checks to see if LDAP/AD authentication is enabled; if so, retreives LDAP/AD settings --->
<cfset QRY_updateSysObjectValueDomain = objAdmin.updateSysObjectValue('#form.Domain#', 'Domain') />
<cfset QRY_updateSysObjectValueServer = objAdmin.updateSysObjectValue('#form.Server#', 'LDAPServer') />
<cfset QRY_updateSysObjectValueAccountOU = objAdmin.updateSysObjectValue('#form.AccountOU#', 'AccountOU') />

06-14-2007, 11:37 PM
Because server-side codes are run on the server to generate HTML/CSS/Javascript codes, while Javascript runs on the client-side. By the time the browser renders the page, all the server-side codes have been completely executed. What you need to do is either:

1. Submit the page to send the request to the server. This requires page refresh.
2. Use AJAX (http://www.w3schools.com/ajax/ajax_intro.asp) to send request to the server without page refresh.