Share

OpenXava

Subscribe

Can OpenXava maintain Browser History

  1. 2009-11-05 14:54:00 UTC

    Can OpenXava maintain Browser History. i.e. Can OpenXava enable the Back button and forward button while changing sections or while adding attachment.

    Scenorio 1) I have a form which has 2 Section saying "Order" and then "Order Details" 2) After user fills up order he clicks "Order Details" and then he clicks Back button of browser. he should see "Order" Section Is this possible?

    Thanks in advance

    CSJakharia

  2. 2009-11-09 12:47:40 UTC

    Hi CSJakharia,

    Can OpenXava maintain Browser History

    No. An OX module is a HTML page whose state is changed via AJAX. So, the user see that data in the page is changed, but really the page is the same. Though, when he click on back go to the last page it visited, p. ej. the last visited OX.

    Is this possible?

    Yes. Implementing it is possible. Moreover, if we narrow the initial functionality to section change and mode (list/detail) change is not too difficult.

    Are you willing to implement and contribute it to OX?

  3. 2009-11-13 10:01:56 UTC

    I have changed the openxava.js for the same I have used http://plugins.jquery.com/project/history

    Changes in the openxava.js openxava.executeAction = function(confirmMessage, takesLong, action, argv) { if(argv!=null) argv=","+argv; else argv=''; jQuery.history.load("action="+action+argv); }

    in openxava.refreshPage add if(firstTime++==0) jQuery.history.init(pageload);

    copy original function openxava.executeAction to openxava.executeAction1as openxava.executeAction1 = function(confirmMessage, takesLong, action, argv) {
    if (confirmMessage != "" && !confirm(confirmMessage)) return; if (takesLong) { document.getElementById('xavaprocessinglayer').style.display='block'; setTimeout('document.images["xavaprocessingImage"].src = "images/processing.gif"', 1); } this.form.xavafocusforward.value = "false"; this.form.xavaaction.value=action; this.form.xavaactionargv.value=argv; if (this.isSubmitNeeded()) { this.form.submit(); } else { this.ajaxRequest(); } }

    Add the below function in openxava.js function pageload(hash) { // hash doesn't contain the first # character. if(hash) { var variables=hash.split(","); var argv=''; for(i=1;i<variables.length;++i) argv+=","+variables[i]; openxava.executeAction1('', false, variables[0].split("=")[1], (argv!=''?argv:null)); } }

    Please comment under which scenorio it will not work Can you pls include this code in openxava?

    CSJakharia

  4. 2009-11-13 10:05:22 UTC
    function pageload(hash) {
            // hash doesn't contain the first # character.
            if(hash) {
                var variables=hash.split(",");
                var argv='';
                for(i=1;i<variables.length;++i)
                    argv+=","+variables[i];
                openxava.executeAction1('', false, variables[0].split("=")[1], (argv!=''?argv:null));
            } 
        }
    
    openxava.executeAction1 = function(confirmMessage, takesLong, action, argv) {       
        if (confirmMessage != "" && !confirm(confirmMessage)) return;
        if (takesLong) {
            document.getElementById('xava_processing_layer').style.display='block';
            setTimeout('document.images["xava_processingImage"].src = "images/processing.gif"', 1);
        }
        this.form.xava_focus_forward.value = "false";
        this.form.xava_action.value=action; 
        this.form.xava_action_argv.value=argv;
        if (this.isSubmitNeeded()) { 
            this.form.submit();
        } 
        else {
            this.ajaxRequest();
        }
    }
    
    in openxava.refreshPage
    if(firstTime++==0)
        {
    
            jQuery.history.init(pageload);
        }
    
    declare a variable var firstTime=0; in start of openxava.js
    

    Please comment under which scenorio it will not work.

    Can you pls include this code in openxava?

    Thanks in advance

    CSJakharia

  5. 2009-11-16 10:34:52 UTC

    Hi CSJakharia,

    I added your code to openxava.js and it does not work. When I try any OpenXava module and I click on any action I get the error:

    this.form has no properties
    

    Download the OpenXava_20091111 from CVS, try to add your code to it. When it works put here, and I'll try again.

< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.