What's wrong with my syntax?

View: New views
4 Messages — Rating Filter:   Alert me  

What's wrong with my syntax?

by juliandormon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to use both afterFileAppend and afterFileRemove. I get an syntax error in javascript:

"Missing } after property list
afterFileAppend:function(element,value,master){"


Here's my code:

$.MultiFile({
       
                afterFileRemove:function(){
                $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15, scrollbarMargin:0, arrowSize: 16});
                }
               
          afterFileAppend:function(element,value,master){
           //alert('File selected:\n'+value + ' ' + element.id  + ' ' + master);
            if (element.id == 'multi_0_1'){
                        $("#multiFileWarning").html('You are uploading more than one file. If you add a title, description, keywords or alt tag, it will be applied to all the images that are being uploaded. You may choose to leave these blank and then update the individual file captions in the Edit/Delete/Sort Media section.<div> </div>');
                        }
                       
            $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15, scrollbarMargin:0, arrowSize: 16});
                }
               
         });


Works fine without the afterFileRemove block.

Much appreciated!

Re: What's wrong with my syntax?

by Theodore Ni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I believe you need a comma after all but the last function, because they are name : value pairs in an object.

On 8/28/07, juliandormon <julian@...> wrote:


I'm trying to use both afterFileAppend and afterFileRemove. I get an syntax
error in javascript:

"Missing } after property list
afterFileAppend:function(element,value,master){"


Here's my code:

$.MultiFile({

               afterFileRemove:function(){
               $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15,
scrollbarMargin:0, arrowSize: 16});
               }

         afterFileAppend:function(element,value,master){
          //alert('File selected:\n'+value + ' ' + element.id  + ' ' + master);
                       if (element.id == 'multi_0_1'){
                       $("#multiFileWarning").html('You are uploading more than one file. If you
add a title, description, keywords or alt tag, it will be applied to all the
images that are being uploaded. You may choose to leave these blank and then
update the individual file captions in the Edit/Delete/Sort Media
section.<div>&nbsp;</div>');
                       }

               $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15,
scrollbarMargin:0, arrowSize: 16});
               }

        });


Works fine without the afterFileRemove block.

Much appreciated!
--
View this message in context: http://www.nabble.com/What%27s-wrong-with-my-syntax--tf4344623s15494.html#a12377448
Sent from the jQuery Multiple File Upload mailing list archive at Nabble.com.




--
Ted

Re: What's wrong with my syntax?

by Erik Beeson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


The syntax for defining an object is:

{
  key1: 'value1',
  key2: 'value2'
}

When one of the values in a function, it looks like:

{
  key1: function() {...},
  key2: '...'
}

Your problem is you need a comma before afterFileAppend:

--Erik


On 8/28/07, juliandormon <julian@...> wrote:

>
>
> I'm trying to use both afterFileAppend and afterFileRemove. I get an syntax
> error in javascript:
>
> "Missing } after property list
> afterFileAppend:function(element,value,master){"
>
>
> Here's my code:
>
> $.MultiFile({
>
>                 afterFileRemove:function(){
>                 $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15,
> scrollbarMargin:0, arrowSize: 16});
>                 }
>
>           afterFileAppend:function(element,value,master){
>            //alert('File selected:\n'+value + ' ' + element.id  + ' ' + master);
>                         if (element.id == 'multi_0_1'){
>                         $("#multiFileWarning").html('You are uploading more than one file. If you
> add a title, description, keywords or alt tag, it will be applied to all the
> images that are being uploaded. You may choose to leave these blank and then
> update the individual file captions in the Edit/Delete/Sort Media
> section.<div> </div>');
>                         }
>
>                 $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15,
> scrollbarMargin:0, arrowSize: 16});
>                 }
>
>          });
>
>
> Works fine without the afterFileRemove block.
>
> Much appreciated!
> --
> View this message in context: http://www.nabble.com/What%27s-wrong-with-my-syntax--tf4344623s15494.html#a12377448
> Sent from the jQuery Multiple File Upload mailing list archive at Nabble.com.
>
>

Re: What's wrong with my syntax?

by juliandormon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Eric,
I see my mistake now. Doh!

Erik Beeson wrote:
The syntax for defining an object is:

{
  key1: 'value1',
  key2: 'value2'
}

When one of the values in a function, it looks like:

{
  key1: function() {...},
  key2: '...'
}

Your problem is you need a comma before afterFileAppend:

--Erik


On 8/28/07, juliandormon <julian@righthookmedia.com> wrote:
>
>
> I'm trying to use both afterFileAppend and afterFileRemove. I get an syntax
> error in javascript:
>
> "Missing } after property list
> afterFileAppend:function(element,value,master){"
>
>
> Here's my code:
>
> $.MultiFile({
>
>                 afterFileRemove:function(){
>                 $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15,
> scrollbarMargin:0, arrowSize: 16});
>                 }
>
>           afterFileAppend:function(element,value,master){
>            //alert('File selected:\n'+value + ' ' + element.id  + ' ' + master);
>                         if (element.id == 'multi_0_1'){
>                         $("#multiFileWarning").html('You are uploading more than one file. If you
> add a title, description, keywords or alt tag, it will be applied to all the
> images that are being uploaded. You may choose to leave these blank and then
> update the individual file captions in the Edit/Delete/Sort Media
> section.<div> </div>');
>                         }
>
>                 $("#galleryEdits").jScrollPane({showArrows:true,scrollbarWidth:15,
> scrollbarMargin:0, arrowSize: 16});
>                 }
>
>          });
>
>
> Works fine without the afterFileRemove block.
>
> Much appreciated!
> --
> View this message in context: http://www.nabble.com/What%27s-wrong-with-my-syntax--tf4344623s15494.html#a12377448
> Sent from the jQuery Multiple File Upload mailing list archive at Nabble.com.
>
>