:: Forum >> Version 1 >>

Why does Firefox refresh page when using paging patch with XML data table?

Works fine in IE, but FF reloads the entire page on both Windows and Mac. Every time i try to go to another page (doesn't matter if its next, previous, first, or last) it displays the correct data for a split second, and then reloads the entire web page (resetting the xml data to the 'first' page).

i can't post an example yet because it's behind a corporate firewall - i will work up a public example if the solution is not already obvious to someone out there ...

the relevant JS is included below:

<script>
    
    
    
//    create ActiveWidgets data model - XML-based table
    
var table = new Active.XML.Table;
    
    
//    create ActiveWidgets Grid javascript object
    
var oGrid = new Active.Controls.Grid;
    
    
    
table.setText = function(valueij){
        var 
node this.getNode(ij);
        
node.text value
    }

    
    
    
    
    
    
    
// url returning xml        
    
table.setURL("xml_users.php?mode=<? printvar($mode) ?>&searchfield=<? printvar($searchfield) ?>&searchterm=<? printvar($searchterm) ?>&securityid=<? echo $securityid ?>");
    
    
    
    
//    start asyncronous data retrieval
    
table.request();    

    
    
//    define column labels
    
var columns = ["ID""Email""First Name""Last Name""Inactive""Created""Last Modified"];
    
    var 
defaultResponse table.response;



    
    
table.response = function(table){
        
defaultResponse.call(thistable);
                        
        
// replace the built-in row model with the new one (defined in the patch)
        
oGrid.setModel("row", new Active.Rows.Page);
        
oGrid.setProperty("row/count"this.getCount());
        
oGrid.setProperty("column/count"7);        
        
oGrid.setProperty("column/texts"columns);    
    
        
        
        
// set page size
        
oGrid.setProperty("row/pageSize"17);            
        
goToPage(0);
    }
    
    
    
    function 
goToPage(delta){            
        var 
rowCount oGrid.getProperty("row/count");
        var 
count oGrid.getProperty("row/pageCount");
        var 
number oGrid.getProperty("row/pageNumber");
        
number += delta;
        if (
number 0) {number 0}
        if (
number count-1) {number count-1}
        
document.getElementById("pagelabel").innerHTML "Page <b>" + (number 1) + "</b> of <b>" count "</b>"
        
document.getElementById("rowlabel").innerHTML "Total Rows  <b>"rowCount +"</b>";
        
oGrid.setProperty("row/pageNumber"number);
        
oGrid.refresh();
    } 
    

    
    
//    provide external model as a grid data source
    
oGrid.setDataModel(table);
    
    
    
// create formats
    
var fstring = new Active.Formats.String;
    var 
fnumber = new Active.Formats.Number;
    var 
fdate = new Active.Formats.Date;
    
fdate.setTextFormat("mm/dd/yyyy hh:mm");
    
fdate.setDataFormat("RFC822");
    
//fdate.setDataFormat("ISO8061");
    
fnumber.setTextFormat("");


    
//    set column formatting
    
table.setFormats([fnumberfstringfstringfstringfstringfdatefdate]);
    
    

    
// handle row actions
    
oGrid.Handler_Edit = function(rowindex) {
        
//alert(this.getDataProperty("value",rowindex,0));
        
var uid = (this.getDataProperty("value",rowindex,0));
        if (
uid 0) {
            
document.location "user.php?securityid=<?=$securityid?>&mode=edit&id=" uid;
        } else {
            
alert("Please select a user.");
        }
    }
    
    
    
oGrid.Handler_History = function(rowindex) {
        var 
uid = (this.getDataProperty("value",rowindex,0));
        if (
uid 0) {
            
document.location "userhistory.php?id=" uid;
        } else {
            
alert("Please select a user.");
        }
    }
    
    

    
oGrid.RowColor_Inactive = function() {
        return (
oGrid.getProperty("data/text"this.getRowProperty("index"), 4) == "inactive""#EAEAEA" "#FFFFFF";
    }
    
    
oGrid.getTemplate("row").setStyle('background'oGrid.RowColor_Inactive); 
    
    
    
// set double-click action handler
    
oGrid.DoubleClickAction = function(src) {
        var 
row src.getRowProperty("index");
        
oGrid.Handler_Edit(row);
    }
    
oGrid.getTemplate("row").setEvent("ondblclick", function(){this.action("DoubleClickAction")});
    
oGrid.setAction("DoubleClickAction"oGrid.DoubleClickAction);
    
    
    
    

    
// initially set selected row
    
<if (isset($theindex)) { ?>        
        
oGrid.setProperty("selection/index", <?=$theindex?>);
    <
?>
    
    
    
    
//    write grid html to the page
    
document.write(oGrid);
    </
script>
 
dave v
Sunday, June 19, 2005
it does the same thing using the php-javascript model - Firefox forces a webpage refresh when trying to change grid 'pages'. ???
dave v
Sunday, June 19, 2005
solved the problem - if the grid resides inside <form> tags, in Firefox it exhibits the weird page refresh behavior above. if the <form> tags are removed, everything is fine ...
dave v
Sunday, June 19, 2005
OK, I understand - it is due to the button click triggering form submit, right?
Alex (ActiveWidgets)
Monday, June 20, 2005
That's right, Alex.
The html button tag has an attribute called type thas has 3 possible values: button, submit and reset.
According to the w3c recomendation, if you don't specify this attribute, the default is submit.
This is exactly what Firefox do, but Internet Explorer does not.
Rafael Vieira
Thursday, July 28, 2005



This topic is archived.

Back to support forum

Forum search