/    Sign up×
Community /Pin to ProfileBookmark

Using query in JS

I am a newbie so please be kind.

I downloaded the popup-picker and the popup-picker-demo code from this site. I am trying to use it with Cold Fusion templates. The popup-picker-demo uses hard coded selects/options but I want to use a CF query.

Below is the popup-picker-demo code:
<SCRIPT LANGUAGE=”JavaScript”>
<!– Original: Shawn A. Mann ([email protected]) –>
<!– Web Site: [url]http://www.laughingshaman.com[/url] –>
<!– Modified By: Ronnie T. Moore, Editor –>

<!– This script and many more are available free online at –>
<!– The JavaScript Source!! [url]http://javascript.internet.com[/url] –>

<!– Begin
function sendValue(s){
var selvalue = s.options[s.selectedIndex].value;
window.opener.document.popupform.choice.value = selvalue;
window.close();
}
// End –>
</script>

</HEAD>

<!– STEP TWO: Copy this code into the BODY of your HTML document –>

<BODY>

<center>
<form name=selectform>
<select name=selectmenu size=”8″>
<option value=”Item A”>Item A
<option value=”Item B”>Item B
<option value=”Item C”>Item C
<option value=”Item D”>Item D
<option value=”Item E”>Item E
<option value=”Item F”>Item F
<option value=”Item G”>Item G
<option value=”Item H”>Item H
<option value=”Item I”>Item I
<option value=”Item J”>Item J
<option value=”Item K”>Item K
<option value=”Item L”>Item L
<option value=”Item M”>Item M
<option value=”Item M”>Item N
<option value=”Item O”>Item O
<option value=”Item P”>Item P
<option value=”Item Q”>Item Q
<option value=”Item R”>Item R
<option value=”Item S”>Item S
<option value=”Item T”>Item T
<option value=”Item U”>Item U
<option value=”Item V”>Item V
<option value=”Item W”>Item W
<option value=”Item X”>Item X
<option value=”Item Y”>Item Y
<option value=”Item Z”>Item Z
</select>
<p>
<input type=button value=”Item Select Item” onClick=”sendValue(this.form.selectmenu);”>
</form>
</center>
<p><center>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”http://javascriptsource.com”>The JavaScript Source</a></font>
</center><p>

<!– Script Size: 2.14 KB –>

Here is my CF code that I want to use (template is called contact_lookup.cfm). The below code list all records that matched the query and I want to be able to click on the cont_row_id field and return the contents of that field to the original form (popup-picker).

<table border=”2″ cellspacing=”0″ cellpadding=”0″ align=”center” bordercolor=”#FFFFFF”>
<tr>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>ID</th>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>First Name</font></th>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>Last Name</th>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>Suffix</th>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>City</th>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>State</th>
<th align=”left” nowrap bgcolor=”#FFFFFF”><font color=”#035089″>Created By</th>
</tr>
<tr><cfoutput query=”dropdown_act_contact”>
<td width=”150″ nowrap bgcolor=”##C0C0C0″>#cont_row_id#</font></td>
<td width=”100″ nowrap><font color=”##035089″><font size=”-1″>#cont_fname#</font></font></td>
<td width=”125″ nowrap><font color=”##035089″><font size=”-1″>#cont_lname#</font></font></td>
<td width=”45″ nowrap><font color=”##035089″><font size=”-1″>#cont_suffix#</font></font></td>
<td width=”200″ nowrap><font color=”##035089″><font size=”-1″>#cont_city#</font></font></td>
<td width=”50″ nowrap><font color=”##035089″><font size=”-1″>#cont_state#</font></font></td>
<td width=”50″ nowrap><font color=”##035089″><font size=”-1″>#cont_created_by#</font></font></td></tr></cfoutput>
</table>

Below is the popup-picker code:

<BODY>

<!– This script and many more are available free online at –>
<!– The JavaScript Source!! [url]http://javascript.internet.com[/url] –>

<!– Original: Shawn A. Mann ([email protected]) –>
<!– Web Site: [url]http://www.laughingshaman.com[/url] –>
<!– Modified By: Ronnie T. Moore, Editor –>

<center>
<form name=popupform>
Item: <input type=button name=choice onClick=”window.open(‘popup_picker_demo.cfm’,’popuppage’,’width=250,height=200,top=100,left=100′);” value=” >> Choose << “><br>
<p>
</form>
</center>
<p><center>
<font face=”arial, helvetica” size”-2″>Free JavaScripts provided<br>
by <a href=”http://javascriptsource.com”>The JavaScript Source</a></font>
</center><p>

Thanks in advance for any help you can provide.
MKT

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@DokSep 29.2006 — You are probably better off asking this in a Cold Fusion forum.
×

Success!

Help @mkt58 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...