User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 423,496 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,720 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 737 | Replies: 1
Reply
Join Date: May 2008
Posts: 2
Reputation: blackheart_22 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
blackheart_22 blackheart_22 is offline Offline
Newbie Poster

PeopleSoft autosave with AJAX

  #1  
May 27th, 2008
Hi, I'm currently applying the autosave code i've got on the internet unfortunately I can't make it work. Below is the error encountered as well as the code being used.


Error Encountered:

Line: 4568
Char: 21
Error: Object Expected


Code being used:

<script  type="text/javascript">

pollingInterval = 5000;

threadLock = false;

saveMessage = "saved"

 function timeoutHandler(){

            clearTimeout(SaveTimeout);

            SaveTimeout = setTimeout("autosave()",pollingInterval);

}

function autosave(){

            var changes = checkFormChanged(document.%formname);

 

            if (changes && !threadLock) {

                        threadLock = true;

                        

    if ("%page" == "EP_APPR_BASE1")

                           $('input[@name=ICAction]').attr({value: 'EP_BTN_LINK_WRK_EP_STORE_PB'});

                        else

                           $('input[@name=ICAction]').attr({value: 'EP_BTN_LINK_WRK_EP_STORE_PB$19$'});

 

                        update_defaults(document.%formname);

 

                        var params = $('form[@name=%formname]').fastSerialize();

    $.ajax({ type: "POST", 

                                                 url: $('form[@name=%formname]').attr("action"), 

                                                 data: $.param( params ), 

                                                 dataType: "xml", 

                                                 success: 

                                                                                    function(msg, msg2)

                                                                                    { 

                                                                                                $('input[@name=ICChanged]').attr({value: '0'});

 

                                                                                    var searchFor = "'ICStateNum' value='";

                                                                                    var stateNumStart = msg.responseText.indexOf(searchFor) + searchFor.length;

                                                                                    var stateNumEnd = msg.responseText.indexOf("'", stateNumStart);

                                                                                    var newState = msg.responseText.substr(stateNumStart, stateNumEnd - stateNumStart);

                                                          $('input[@name=ICStateNum]').attr({value: newState});                                                                                 

                                                                                    display_notification();

            

                                                                                                            SaveTimeout = setTimeout ( "autosave()", pollingInterval );

                                                          

                                                          var SearchFor = null;

                                                          var stateNumStart = null;

                                                          var stateNumEnd = null;

                                                                                                            threadLock = false;

                                                                        }

                                    });

                                    }

                                    else

                                    {

                        SaveTimeout = setTimeout ( "autosave()", pollingInterval);

                                    };

};

 

function start_autosave(){

                        if ("%PAGE" == "EP_APPR_MAIN1" || "%PAGE" == "EP_APPR_BASE1")

                                    

                    if ($('input[@name=ICChanged]').val() != 0){

                                                SaveTimeout = setTimeout ( "autosave()", 1);

                                                }

                                                else

                                                {

                                                            SaveTimeout = setTimeout ( "autosave()", pollingInterval );

                                                }

            $('body').keypress(timeoutHandler);

 

            submitAction_%Formname = function(form, name){

 

                        form = $('form')[0];

                        $('body').css({cursor: "wait"});

                        function submit_the_form()

                        {

                                    form.ICAction.value=name;

                                    form.ICXPos.value=getScrollX();

                                    form.ICYPos.value=getScrollY();

                                    processing_%Formname(1,3000);

                                    form.ICResubmit.value=nResubmit;

                                    form.submit();

                                    nResubmit++;

                        }

                        function check_for_lock()

                        {

                                    if (threadLock){

                                                setTimeout("submitAction_%Formname('" + %formname + "','" + name + "')",250);

                                    }

                                    else{

                                                submit_the_form();

                                    }

                        }

                        check_for_lock();

            };

};

function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      if (oldonload) {

        oldonload();

      }

      func();

    }

  }

};

 

if ("%page" == "EP_APPR_MAIN1" || "%page" == "EP_APPR_BASE1")

{

addLoadEvent(start_autosave);

};

</script>
Last edited by ~s.o.s~ : May 28th, 2008 at 11:10 pm. Reason: Added code tags, learn to use them.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,851
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 344
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: PeopleSoft autosave with AJAX

  #2  
May 28th, 2008
Server side code has no place in the Javascript code, you should take a look at the generated code to pinpoint your problem. Use tools like the Error Console of Firefox and Firebug to debug your code.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:09 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC