Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using ListBox slection to Generate New Recordset

New Here ,
Jun 15, 2006 Jun 15, 2006
Hello;

I am new to ASP as well as Dreamweaver 8. I have been able to figure out a lot of things by self teaching but now I am stuck. (perhaps I am exhausted after so many hours!).

I have created an ASP page where I have inserted a dynamic Listbox in it. I have successfuly populated the listbox.

Here is what I m trying to do: when the user makes a selection in the Listbox, I would like to use the "onChange" event (which I still can't figure out how to use it) to generate a Recordset using the value of the selection. The new Recordset will give me a filename (which is in the database) that the user can download by clicking on a link. You could call it a Dynamic Link since everytime the user makes a different selction in the listbox, the link will link to a different filename.

I have been working on this for at least 12 hours and eventhough I usually catchup very quickly, this one I am having a hard time with.

Your help will be greatly appreciated.
TOPICS
Server side applications
606
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 16, 2006 Jun 16, 2006
<a href="javascript:;"
onClick="window.open(document.form1.selectChild.options[document.form1.selectChild.selectedIndex].value,'docWindow','')">Open
Document</a>

"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6uevb$jt1$1@forums.macromedia.com...
>I have tried this as a hyperlink for a text but it does not work!
>
> <a href="document.form1.selectChild.selectedIndex.value">
>
> Any idea to refrence to the value of the listbox. If the above syntax
> worked,
> it would have e...
Translate
LEGEND ,
Jun 15, 2006 Jun 15, 2006
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_19117


"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6sjen$apb$1@forums.macromedia.com...
> Hello;
>
> I am new to ASP as well as Dreamweaver 8. I have been able to figure out
> a
> lot of things by self teaching but now I am stuck. (perhaps I am exhausted
> after so many hours!).
>
> I have created an ASP page where I have inserted a dynamic Listbox in it.
> I
> have successfuly populated the listbox.
>
> Here is what I m trying to do: when the user makes a selection in the
> Listbox, I would like to use the "onChange" event (which I still can't
> figure
> out how to use it) to generate a Recordset using the value of the
> selection.
> The new Recordset will give me a filename (which is in the database) that
> the
> user can download by clicking on a link. You could call it a Dynamic Link
> since everytime the user makes a different selction in the listbox, the
> link
> will link to a different filename.
>
> I have been working on this for at least 12 hours and eventhough I usually
> catchup very quickly, this one I am having a hard time with.
>
> Your help will be greatly appreciated.
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 15, 2006 Jun 15, 2006
Thank You. That works just fine except I have now one last problem: The value of the second listbox (The Child listbox) actually reffers to a file (a pdf document to be exact). What I would like to do is to allow the user to download the file (or even open it in the browser) when they select it. Any idea?

quote:

Originally posted by: Newsgroup User
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_19117


"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6sjen$apb$1@forums.macromedia.com...
> Hello;
>
> I am new to ASP as well as Dreamweaver 8. I have been able to figure out
> a
> lot of things by self teaching but now I am stuck. (perhaps I am exhausted
> after so many hours!).
>
> I have created an ASP page where I have inserted a dynamic Listbox in it.
> I
> have successfuly populated the listbox.
>
> Here is what I m trying to do: when the user makes a selection in the
> Listbox, I would like to use the "onChange" event (which I still can't
> figure
> out how to use it) to generate a Recordset using the value of the
> selection.
> The new Recordset will give me a filename (which is in the database) that
> the
> user can download by clicking on a link. You could call it a Dynamic Link
> since everytime the user makes a different selction in the listbox, the
> link
> will link to a different filename.
>
> I have been working on this for at least 12 hours and eventhough I usually
> catchup very quickly, this one I am having a hard time with.
>
> Your help will be greatly appreciated.
>





Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2006 Jun 16, 2006
I have tried this as a hyperlink for a text but it does not work!

<a href="document.form1.selectChild.selectedIndex.value">

Any idea to refrence to the value of the listbox. If the above syntax worked, it would have either openned or downloaded the pdf document!!

Any help would be greatly appreciated
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 16, 2006 Jun 16, 2006
<a href="javascript:;"
onClick="window.open(document.form1.selectChild.options[document.form1.selectChild.selectedIndex].value,'docWindow','')">Open
Document</a>

"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6uevb$jt1$1@forums.macromedia.com...
>I have tried this as a hyperlink for a text but it does not work!
>
> <a href="document.form1.selectChild.selectedIndex.value">
>
> Any idea to refrence to the value of the listbox. If the above syntax
> worked,
> it would have either openned or downloaded the pdf document!!
>
> Any help would be greatly appreciated
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2006 Jun 16, 2006
Thank you very much!!! The nice thing is that I placed your Javascript code into the onClick behavior of the list box and i get the same results, now I don't even need the text link. Thank You again.

quote:

Originally posted by: Newsgroup User
<a href="javascript:;"
onClick="window.open(document.form1.selectChild.options[document.form1.selectChild.selectedIndex].value,'docWindow','')">Open
Document</a>

"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6uevb$jt1$1@forums.macromedia.com...
>I have tried this as a hyperlink for a text but it does not work!
>
> <a href="document.form1.selectChild.selectedIndex.value">
>
> Any idea to refrence to the value of the listbox. If the above syntax
> worked,
> it would have either openned or downloaded the pdf document!!
>
> Any help would be greatly appreciated
>





Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 16, 2006 Jun 16, 2006

"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6utin$8im$1@forums.macromedia.com...
> Thank you very much!!! The nice thing is that I placed your Javascript
> code
> into the onClick behavior of the list box and i get the same results, now
> I
> don't even need the text link. Thank You again.

Perhaps onSelect would work better.
If you attach the behavior to the list itself, all
"document.form1.selectChild" references can be replaced with "this".
this.options[this.selectedIndex].value


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2006 Jun 17, 2006
I understand. I tried to take it one step further and create a JavaScript function. The reason i did that is because i wanted to place my documents in a folder called "Documents". As it is i woudl have to place all the documents in the root of the site but if i placed the docuemnts in a seperate folder it will be a lot neater (call me anal if you wish). So i wrote the following JavaScript function to append the folder name to the value of the seleted item but it is not working properly. Here is my script:

funtion openDocuments()

var myDocument = "Document/";

myDocument =myDocument+document.form1.selectChild.options[document.form1.selectChild.selectedIndex].value;

{
window.open(myDocument,'docWindow','');
}

Any idea what I am doing wrong?


quote:

Originally posted by: Newsgroup User

"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6utin$8im$1@forums.macromedia.com...
> Thank you very much!!! The nice thing is that I placed your Javascript
> code
> into the onClick behavior of the list box and i get the same results, now
> I
> don't even need the text link. Thank You again.

Perhaps onSelect would work better.
If you attach the behavior to the list itself, all
"document.form1.selectChild" references can be replaced with "this".
this.options[this.selectedIndex].value





Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2006 Jun 17, 2006
B.T.W. the listbox in Dreamweaver does not support onSelect property.


quote:

Originally posted by: Newsgroup User

"esonline" <webforumsuser@macromedia.com> wrote in message
news:e6utin$8im$1@forums.macromedia.com...
> Thank you very much!!! The nice thing is that I placed your Javascript
> code
> into the onClick behavior of the list box and i get the same results, now
> I
> don't even need the text link. Thank You again.

Perhaps onSelect would work better.
If you attach the behavior to the list itself, all
"document.form1.selectChild" references can be replaced with "this".
this.options[this.selectedIndex].value





Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 19, 2006 Jun 19, 2006
LATEST
onSelect is supported depending on what's selected in the "show events for"
menu. It's probably on v4 browsers by default.
In any case, your script doesn't work because you've misspelled "function"
and failed to use braces to indicate the function body, so the function is
not being constructed. You've probably got the little yellow exclamation
point icon in your status bar, indicating a javascript error. Most likely,
it says "object expected". If you're using Firefox, check your JavaScript
Console.
Here's a cleaned-up version of your script.

In your <head> section:
<script type="text/javascript">
funtion openDocument(myList)
{
var myDocument = "Document/";
myDocument+=myList.options[myList.selectedIndex].value;
window.open(myDocument,'docWindow','');
}
</script>

On your child list:
<select name="selectChild" onChange="openDocument(this)">

If it doesn't work, please describe HOW it doesn't work as well. i.e., the
window opens, but you get a 404 error, etc.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines