SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question autosave functionality in peoplesoft

    hi, i've placed an autosave code (which i've got in the internet) in an HTML area (property is constant) then when I access the page where the code has been included, I've encountered an IE error which states:

    Char: 41

    Error: Expected '{'



    here's the 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 display_notification(){
    var topValue = window.pageYOffset;
    if (! topValue )
    topValue = document.documentElement.scrollTop;
    if (! topValue )
    topValue = document.body.scrollTop;
    var topValue = topValue.toString() + "px";
    notification.css({top: topValue});
    $("body").append(notification);
    notification.fadeIn("fast",
    function(){
    setTimeout("fade_notification()", 2000);
    });
    topValue = null;
    };
    function fade_notification(){
    notification.fadeOut("slow",
    function(){
    notification.remove();
    }
    );
    };
    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() {
    oldonload();
    func();
    }
    }
    };

    if ("%page" == "EP_APPR_MAIN1" || "%page" == "EP_APPR_BASE1")
    {
    addLoadEvent(start_autosave);
    };
    </script>



    thanks,
    blackheart_22

  2. #2
    SitePoint Wizard ~ServerPoint~'s Avatar
    Join Date
    Nov 2007
    Posts
    1,813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Strange? Do you haver readme file? It seems that several steps were lost.
    ServerPoint.com - a true hosting company since 1998
    Web Hosting, colocation,
    dedicated servers, Virtual Private Server (VPS) hosting

  3. #3
    SitePoint Member
    Join Date
    May 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've just got the code from www.wiki.ittoolbox.com - Peoplesoft Autosave with Ajax then i just edit the code to correct the errors.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •