Reply
Access to "parent class"
Old 02-09-2008, 12:29 PM Access to "parent class"
Junior Talker

Posts: 1
Name: Solveig Rois
I'd like to access a class above the one that is accessible via "this". Is there something like PHP's "parent::"?

I use the "Prototype"-JS-Lib, just to make my example code more understandable...

I'll post some code to explain my problem:

Code:
var comments = {
    isFormOk: function()
    {
        progressIndicator('comment-sent', {status: 'load'});
        
        var elementsFail = checkUserData(['title', 'desc', 'mail'], '');
        elementsFail.each(function(element) {
            $('l' + element).setStyle({color: 'rgb(255, 0, 0)'});
        });
        
        if (!elementsFail.length)
        {
            progressIndicator('comment-sent', {status: 'none'});
            return true;
        }
        else
        {
            progressIndicator('comment-sent', {status: 'fail'});
            return false;
        }
    },
    sendComment: function()
    {
        if (this.isFormOk())
        {
            instance = this;
            $('comment').request(
            {
                parameters: {title: $F('title'), desc: $F('desc'), mail: $F('mail'), name: $F('name')},
                encoding: 'utf-8',
                onSuccess: function(response)
                {
                    this.isServerScriptOk(response); //at this point I'd like to call isServerScriptOk() function, which is one level above (?)...
                },
                onFailure: function()
                {
                    progressIndicator('comment-sent', {status: 'fail'});
                },
                onCreate: function()
                {
                    progressIndicator('comment-sent', {status: 'load'});
                    writeUserData(['name', 'mail']);
                }
            });
        }
    },
    isServerScriptOk: function(response)
    {
        if(response.responseText)
        {
            progressIndicator('comment-sent', {status: 'ok'});
        }
        else
        {
            progressIndicator('comment-sent', {status: 'fail'});
        }
    },
    toggleNewComment: function()
    {
        Effect.toggle('newcomment', 'slide', {beforeStart: function() {
            insertUserData(readUserData(['name', 'mail']));
        }});
    }
}
Hoping for many useful answers ...

Many thanks in advance!
dodeantn23 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Reply     « Reply to Access to "parent class"
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.30053 seconds with 13 queries