Jump to content

Works in Firefox & Opera, but not IE 8


aipragma

Recommended Posts

1) This issue involves just one html webpage, lets call it "ajax.html".

 

2) I have AJAX functions in this webpage that work in both Firefox and IE8.

 

3) I now attempt generating just the option values of a dropdown list of dates using my ajax functions, and it works in Firefox & Opera, but not IE8.

 

4) The surrounding html code for the dropdown looks like this:

<select name="entry_7_single" id="entry_7" onChange="Ajax_PhpResultsWithVar('./secure/db/SummaryCls.php','entry_8','dateval',this.value)"></select>

 

The onchange call refers to an ajax function that successfully(both Firefox & IE8) populates a textarea(entry_8) with a description of an event associated with the date selected in this dropdown.

 

5) An onload call initiates the ajax function to generate the dropdown list values:

<body class="ss-base-body" onLoad="OnLoadWebPage()">

 

6) The js script that calls the ajax function is as follows:

 

function OnLoadWebPage()

{

    Ajax_PhpResults('./secure/db/GenDateListCls.php','entry_7');

}

 

7) Since it works in Firefox, but not IE8, I throw the output of the ajax function into a Firefox large textbox and I get the following:

 

<option selected value="8 JUN 2010">8 JUN 2010</option>

                  <option value="9 JUN 2010">9 JUN 2010</option>

                  <option value="10 JUN 2010">10 JUN 2010</option>

                  <option value="11 JUN 2010">11 JUN 2010</option>

 

8 ) There are over a hundred generated but you get the gist of what the ajax function generates. Next I will list the PHP function that outputs the above dropdown values:

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////

<?php

include_once 'SPSQLite.class.php';

include_once 'misc_funcs.php';

 

class GenDateListCls

{

    var $dbName;

    var $sqlite;

   

    function GenDateListCls()

    {

        $this->dbName = 'accrsc.db';

        $this->ConstructEventDates();

    }

   

    function ConstructEventDates()

    {

        $this->sqlite = new SPSQLite($this->dbName);

 

        $todayarr = getdate();

        $today = $todayarr[mday] . " " . substr($todayarr[month],0,3) . " " . $todayarr[year];

       

        $ICalDate = ChangeToICalDate($today);

      $dateQuery = "SELECT dtstart from events where substr(dtstart,1,8) >= '" . $ICalDate . "';";

      $this->sqlite->query($dateQuery);

        $datesResult = $this->sqlite->returnRows();

   

        foreach (array_reverse($datesResult) as $indx => $row)

        {       

              $normDate = NormalizeICalDate(substr($row[dtstart],0,8));

              if ($indx==0)

              {

?>

                <option selected value=<?php echo('"' . $normDate . '"'); ?>><?php echo $normDate; ?></option><?php               

              }           

              else

              {

?>

                  <option value=<?php echo('"' . $normDate . '"'); ?>><?php echo $normDate; ?></option><?php                   

              }             

        }         

        $this->sqlite->close();

    }

}

 

$dateList = new GenDateListCls();

   

?>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

<<<

I appreciate any assistance on this matter.

Aipragma

>>>

 

Link to comment
https://forums.phpfreaks.com/topic/204225-works-in-firefox-opera-but-not-ie-8/
Share on other sites

Reply to 'anatak':

 

I did list my select code in first posting, it is as follows:

 

<select name="entry_7_single" id="entry_7" onChange="Ajax_PhpResultsWithVar('./secure/db/SummaryCls.php','entry_8','dateval',this.value)"></select>

 

To let you all know, I am a complete newbie to PHP, Ajax, & javascript, and learning it all on my own, no classes. My background is in Linux, Windows, C++, Java, VB,VBA,MS XML, & some html. So the comment by 'ignace' is unproductive & ignorant.

 

Thanks anatak for any help.

 

Aipragma

 

Hello Aipragma,

 

Sorry I overlooked the <select> in your first block of code. I was just looking at the HTML output

 

PS don't react to comments like ignace's

you ll learn quickly enough that there are a lot of these on all forums.

you could try stackoverflow.com if you can't find the solution here.

Got a solution, Anatak, from the website you suggested (stackoverflow.com), from a person named Tau.

http.onreadystatechange = function(){
    if(http.readyState == 4){
        eval("var data = [" + http.responseText + "]");
        for(var i=0;i<data.length;i++) {
            var t = document.createElement("option");
            t.value = data[i].value;
            t.innerHTML = data[i].text;
            document.getElementById("entry_7").appendChild(t);
        }
    }
}

 

PHP output (aka your http.responseText):

 

{value:"20100608",text:"date 1"},
{value:"20100609",text:"date 2"},
{value:"20100610",text:"date 3"},
{value:"20100611",text:"date 4"},
{value:"20100612",text:"date 5"}

 

The link to that answer is as follows:

http://stackoverflow.com/questions/3002826/works-in-firefox-opera-but-not-in-ie8

 

Thanks again, Anatak.

 

Ai Pragma

[email protected]

Austin,TX

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.