In your code:
                selector.change(function() {
                  var directory = selector.val();
                });

'directory' is a local variable. The value of it will not be
understood outside of this function, such as in your fileUpload AJAX
code.

You should set a global variable:

var directory = null;

$(document).ready(function() {
                // code

                selector.change(function() {
                  directory = selector.val();  // note that the 'var'
has been removed
                });

               // more code
});

If that did not solve your issues, could you also specify where/how
exactly are you determining the value of the select? Are you alerting
it in your code somewhere?


On May 28, 10:18 am, "Youri v/d Bogert" <xeo...@gmail.com> wrote:
> That didnt solve the problem, i still get the other value.
>
> 2009/5/28 James <james.gp....@gmail.com>
>
>
>
>
>
> > Your <options>'s are suppose to use the 'value' attribute:
>
> > You have:
> > <option id="introductie">introductie</option>
>
> > You should use:
> > <option value="introductie">introductie</option>
>
> > On May 28, 5:45 am, Y vd Bogert <xeo...@gmail.com> wrote:
> > > In my html select code i've got the following options:
> > > <select name="dir" id="selectList">
> > >   <option id="introductie">introductie</option>
> > >   <option id="offertes">offertes</option>
> > > </select>
>
> > > But when i select offertes it always shows my value as introductie?
>
> > > Full page code:
> > > <h1> Bestand toevoegen </h1>
> > > <p> Voer alle gegevens zo zorgvuldig mogelijk in. </p>
> > >   <div id="submit">
> > >     <ul class="list">
> > >       <form name="upload" />
> > >         <li> Directorie: <?php $dir->fileToevoegen(); ?></li>
> > >         <li> <input type="file" name="fileInput" id="fileInput" /> </
> > > li>
> > >         <li> <a href="javascript:$('#fileInput').fileUploadStart
> > > ();">Upload Files</a>
> > >         <script type="text/javascript">
> > >           $(document).ready(function() {
>
> > >                 var selector = $('#selectList');
>
> > >                 selector.change(function() {
> > >                   var directory = selector.val();
> > >                 });
>
> > >                 $('#fileInput').fileUpload ({
> > >                 'uploader'  : '_phpincludes/template/swf/
> > > uploader.swf',
> > >                 'script'    : '_phpincludes/lib/upload.php',
> > >                 'cancelImg' : '_phpincludes/template/img/cancel.png',
> > >                 'auto'      : false,
> > >                 'multi'     : true,
> > >                 'buttonText': 'Select bestanden',
> > >                 'folder'    : 'documenten/' + directory + '/' ,
> > >                 'onError': function (a, b, c, d) {
> > >                             if (d.status == 404)
> > >                               alert('Could not find upload script. Use
> > > a path relative to: '+'<?= getcwd() ?>');
> > >                             else if (d.type === "HTTP")
> > >                               alert('error '+d.type+": "+d.status);
> > >                             else if (d.type ==="File Size")
> > >                               alert(c.name+' '+d.type+' Limit:
> > > '+Math.round(d.sizeLimit/1024)+'KB');
> > >                             else
> > >                               alert('error '+d.type+": "+d.text);
> > >                             },
> > >                             'onComplete': function(a, b, c, d, e){
> > >                             if (d !== '1')
> > >                             alert('Bestanden zijn geupload. U word nu
> > > doorgestuurd naar de index.');
> > >                             window.location = mainAdres;
> > >                 }
> > >                 });
>
> > >           });
> > >         </script>
> > >       </form>
> > >     </ul>
> > >   </div>
>
> --
> Youri v/d Bogert

Reply via email to