Page 1 of 1

Opening Word Docs etc from drop down list (Intranet)

Posted: Thu Feb 28, 2008 4:16 am
by Karoti
I have managed to create a list of hyperlinks that work opening any kind of document...

What I would like to do is open docs from a dropdown list... I have poulated the list and it works for pdf's, but for doc or xls files, it fails.

Code: Select all

 
echo "<select name='filelist' id='filelist' onchange=\"window.open(filelist.options[filelist.selectedIndex].value)\"> ";
         echo "<option value='' selected></option>";
         foreach ($filearray as $value) echo "<option value='$path/$value'>$value</option>";
         echo "</select>";
Any help to a relative novice would be gratefully received.

Re: Opening Word Docs etc from drop down list (Intranet)

Posted: Thu Feb 28, 2008 4:36 am
by Chris Corbyn
What does the generated markup of these failing ones look like? I suspect the PHP output contains some quotes which are breaking the "value" attribute.

Also, it's probably best to use "this" when putting your onchange inline like that:

Code: Select all

window.open(this.options[this.selectedIndex].value);

Re: Opening Word Docs etc from drop down list (Intranet)

Posted: Thu Feb 28, 2008 7:48 am
by Karoti
Thanks... what I have realised this morning is that it is only MY pc that it fails to work on, I have tried a dozen or so other pc's on the network and it works perfectly. DRAT!! having spent hours trying to get it to work!

I only now have to find what's different on my pc.

Re: Opening Word Docs etc from drop down list (Intranet)

Posted: Thu Feb 28, 2008 10:31 am
by Karoti
It was the Intranet Zone security settings, for some reason my m/c was set higher than the default.