Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
newcf #1
Onlick and Passing varible
I have the page: one textbox, one button using Onclick. User enter name from
textbox then click "Go button", pop-up page open and display name. I want able
to pass the value from the txtbox to the pop-up page so i can filter down for
my search
<script language="JavaScript">
function lookup(srchVal, returnTo) {
var url = "ldaplookup.cfm?name=" + srchVal + "&ret=" + returnTo;
var lt = (screen.width - 490) / 2;
var up = (screen.height - 175) / 2;
window.open(url, "LDAP", "width=540," + "height=175," + "left=" + lt +
",top=" + up + " scrollbars, resizable, alwaysRaised", "False");
}
function addName(userinfo) {
if(userinfo != "") {
var infoArray = userinfo.split("|");
document.frm.Name.value = infoArray[0];
document.frm.UserID.value = infoArray[1];
}
}</script>
=============================
FORM.CFM
=============================
Name: <input type="text" name="RequestorName">
<script language="JavaScript">document.write('<input type="button"
value="Lookup Name" name="x500Lookup"
onclick=lookup(document.frm.Name.value,"addName")> </td>');</script>
==============================
ldaplookup.cfm
==============================
<cfldap name="results"
server="X500.JSC.NASA.GOV"
action="QUERY"
attributes="roomnumber,userClass,mail,telephonenum ber, sn"
filter="(sn ~='#Name#')"
sort="sn Asc"
scope="Subtree"
start="ou=whtg ,o=administration,c=us">
<cfoutput>#Name#</cfoutput><br>
ERROR:
Variable NAME is undefined.
newcf Guest
-
Varible clearance, mouse/keyboard
I seem to be having problems with my login scripts. I have mentioned this here before, but have some more ideas i would like to run past you all.... -
passing varible
How do I pass the automatic name from page to page to find out the value. Here is my explanation. I have index.cfm with all the radio boxes for... -
2 onlick events?
I have a clickable image that I would like to convert into a server control imagebutton accessing a server-side onClick event and a client-side... -
Varible Problem
Hi, I have a problem with the structure of my website which is causing problem with passing variables between functions, even when declared as... -
Seting A Flash Varible with a URL
Hey all, I posted this question to data_intergration and got no responce, thought this might be a better forum for it. I need to set a varible... -
mxstu #2
Re: Onlick and Passing varible
> .... onclick=lookup(document.frm.Name.value,"addName")> </td>');</script>
Make sure the reference to the textbox value is correct.
1) Is your form actually named "frm" ?
2) Is the textbox name "RequestorName" or "Name". Make sure to use the
correct case.
Also, you should scope the variable in the "ldaplookup.cfm" page.
<cfoutput>#url.Name#</cfoutput><br>
mxstu Guest
-
newcf #3
Re: Onlick and Passing varible
msxtu,
Thanks for point that out. I acutally copy and paste.
Yes, the form name is frm and the texbox name is RequestorName
Thanks
newcf Guest
-
mxstu #4
Re: Onlick and Passing varible
It worked fine for me.
<script language="JavaScript">
function lookup(srchVal, returnTo) {
var url = "ldaplookup.cfm?name=" + srchVal + "&ret=" + returnTo;
var lt = (screen.width - 490) / 2;
var up = (screen.height - 175) / 2;
window.open(url, "LDAP", "width=540," + "height=175," + "left=" + lt +
",top=" + up + " scrollbars, resizable, alwaysRaised", "False");
}
</script>
=============================
FORM.CFM
=============================
<form name="frm">
Name: <input type="text" name="RequestorName">
<script language="JavaScript">document.write('<input type="button"
value="Lookup Name" name="x500Lookup"
onclick=lookup(document.frm.RequestorName.value,"a ddName")></td>');</script>
</form>
=============================
LDAPLOOKUP.CFM
=============================
<cfoutput>#url.Name#</cfoutput><br>
mxstu Guest
-
newcf #5
Re: Onlick and Passing varible
msxtu,
Thanks alot. I can't try it from home, will try it tomorrow and let you know.
what I try to do is passing the name from the textbox into my filter from
cfldap query. sn is the lname, and given name is the fname. User might enter :
lname, fname OR lname. I also have to specify two attributes for starts.
Please tell me if i have the incorect systax.
<cfldap name="results"
server="X500"
action="QUERY"
attributes="roomnumber,userClass,mail,telephonenum ber, sn"
filter="(|(sn ~=#RequestorName#) (givenname ~=#RequestorName#) )"
sort="sn Asc"
scope="Subtree"
start="(&(ou=whtg ,o=administration,c=us) (ou=jku,o=administration,c=us))"
newcf Guest
-
mxstu #6
Re: Onlick and Passing varible
You may need to parse the #url.RequestorName# value to extract a first or last
name, but the concept of passing the value to the popup window is fine. I
haven't used ldap in a while, so I would check your ldap documentation for the
right syntax :-)
mxstu Guest
-
newcf #7
Re: Onlick and Passing varible
msxtu,
I still getting the error. the output is <cfoutput>#url.RequestorName#</cfoutput> not <cfoutput>#url.Name#</cfoutput>. RequestorName is the name for the textbox
newcf Guest
-
mxstu #8
Re: Onlick and Passing varible
Did you try the exact code I posted? Or did you modify it?
....var url = "ldaplookup.cfm?name=" + srchVal + "&ret=" + returnTo;
On the "ldapLookup.cfm" page make sure you are reference the url variable that
was passed, and not the name of the text box in the main form.
mxstu Guest
-



Reply With Quote

