Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect with DD Box populated with P/N 1

Status
Not open for further replies.

rolap

Programmer
Dec 3, 2000
4
US
I have a drop down box that is populated with P/N's from a D/B each P/N has it own URL in the D/B. I want the user to select a part number and the bottom frame to load the Url associated with the P/N. I can populate the drop down box no problem but can not get it to redirect. Here some code:

<cfquery name=&quot;Get_PartNumbers&quot; datasource=&quot;ewi&quot; dbtype=&quot;ODBC&quot;>
Select PN, Location
From Directory
Order by PN
</cfquery>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- JavaScript begins...

function jump (page) {
//alert(page);
window.location = page;
}

// JavaScript ends -->

</SCRIPT>



</HEAD>
<BODY>
<TABLE Width=&quot;100%&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;0&quot; background=&quot;images/Back_a.gif&quot; >

<TR>
<TD><IMG height=92 alt=&quot;&quot; src=&quot;images/logo-corp.gif&quot; width=144 border=0></TD>

<td align=&quot;Left&quot; valign=&quot;bottom&quot;>Select Part Number  

<SELECT NAME=&quot;page&quot; onChange = Location>
<CFOUTPUT query=&quot;Get_PartNumbers&quot;>
<OPTION value=#PN# selected> #PN# </OPTION>
</CFOUTPUT>


</SELECT>
</TD>
 
<SELECT NAME=&quot;page&quot; onChange = &quot;javascript:jump(this.options[this.selectedindex].value)&quot;>
<CFOUTPUT query=&quot;Get_PartNumbers&quot;>
<OPTION value=&quot;#location#&quot;> #PN# </OPTION>
</CFOUTPUT>
</select>

 
Is the following Java script need more to it to work not sure where to go with the (this.options[this.selectedindex].value)



javascript:jump(this.options[this.selectedindex].value)&quot;>

Thanks
Robert
 
well now it depends mainly on which browser you (your users) are using
the this.options[this.selectedindex].value should return the VALUE of the selected item in ie4+ (try to alert(this.options[this.selectedindex].value) to see)
you can search this forum (and html/dhtml and/or javascript forums) for cross browser problems or dom (document object model) if you're interested in how to do this in netscape or whatever
 
My users use IE4 or greater only, on a intranet. When I execute the script I get an error 0 not sure where to go to start to trouble shoot the whole problem. I left the Javascript:Jump part just as it is written above is it still supposed to execute written that way?
 
tell me what it says :
<SELECT NAME=&quot;page&quot; onChange = &quot;javascript:alert(this.options[this.selectedindex].value)&quot;>
should pop up an alert box with the option selected VALUE

if it doesn't work then
<SELECT NAME=&quot;page&quot; onChange = &quot;javascript:alert(this.name)&quot;>
to see who is &quot;this&quot; (coz it may be the form object in your case - as i don't see all of your code ...)
and if it doesn't say 'page' then try
<SELECT NAME=&quot;page&quot; onChange = &quot;javascript:alert(this.page.options[this.page.selectedindex].value)&quot;>
this should work
now you can replace the &quot;alert&quot; with &quot;jump&quot;

and if it's still not working, go on reading the doc on the select object and how to access its values coz i don't have much much time right now

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top