SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: MSIE Processing

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MSIE Processing

    All,

    I have this page with check-box on it and it processes fine in Firefox and Safari, but MSIE does not respond when I click (toggle) the checkbox. My code is in PB at:

    http://pastebin.ca/1279743

    The lines which work the checkbox are lines:

    233-241, 303-305, 406-412 and 501-524

    with 303-305 where the processing is assigned to the checkbox.

    Appears I need something else in these lines as the rest of the processing works fine, but the processing does not get called in MSIE.

    What am I missing?

    All help appreciated!

    Thanks

    OMR

  2. #2
    SitePoint Addict wibble wobble's Avatar
    Join Date
    Dec 2008
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Server side scripts wont affect the browser in any way (unless you force it to by looking at the user-agent...). Something else is causing IE to hang for you.
    Find freelance jobs from all the major sites in one place:
    on twitter / on the web / twitter rss feed

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you're saying that the javascript function named submit() doesn't seem to be working correctly?

    You need to be more detailed. Saying "processing" and "work the checkbox" are very vague.

    Do some debugging. At each step check the value of your variables, and make sure the conditional code blocks are being executed. In php you can do this with var_dump(). In javascript you can use alert()

    For example, given this code
    PHP Code:
    if ($foo == 'bar') {
        echo 
    'condition true';
        
    // more code here...

    If the condition wasn't true, then debug and find out why.
    PHP Code:
    // lets find out the value of $foo since its obviously not what we think...
    var_dump($foo);

    if (
    $foo == 'bar') {
        echo 
    'condition true';
        
    // more code here...

    Step through the problem code like that and you will narrow to the problem area in a minute or two.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All,

    Some other users I interface with suggested I change my code (line 302-307 of the PB) from:
    Code:
                               <td align=left width=25%>
    
                                    <input type="hidden" name="submitted" value='<?php echo $sub_vl; ?>'>
    
                                    <input name='see_ord' type=checkbox <?php echo $chk_st; ?>
    
                                    onclick="submit()">
    
                                    View Last order
    
                               </td>
    to:
    Code:
                               <td align=left width=25%>
    
                                    <input type="hidden" name="submitted" value='<?php echo $sub_vl; ?>'>
    
                                    <input name='see_ord' type=checkbox <?php echo $chk_st; ?>
    
                                    onclick="javascript:document.valclick.submit()">
    
                                    View Last order
    
                               </td>
    They say I then need a javascript to force PHP to reprocess.

    Not much of a javahead, so what do I put in the script to force MSIE to reprocess the PHP?

    Examples please!

    OMR

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,837
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    JavaScript can't force PHP to rerun unless it is used to force a page reload.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    JavaScript can't force PHP to rerun unless it is used to force a page reload.
    Example please

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2008
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found examples which I tested and didn't work. When I tweaked my code to match the examples even my FF and Safari quit working. Must have the following to work there:
    <input type="hidden" name="submitted" value='<?php echo $sub_vl; ?>'>
    <input name='see_ord' type=checkbox <?php echo $chk_st; ?>
    onclick="document.valclick.submit()">
    View Last order
    The associated PHP code is:
    Code:
        $sub_val     =     $_POST['submitted'];
        $see_val     =     $_POST['see_ord'];
        $ord_val     =     $_POST['ord_sub'];
        $sub_vl        =    $_SESSION['shw_ord'];
        $chk_st        =    $_SESSION['shw_chk'];
        if ($_POST['ord_sub']) {            // Add to & display basket
            include 'add2basket.php'; 
            include 'basket.php';
            exit;
        } else {
            if ($sub_val==0 && !$ord_val) {
                $chk_st = 'checked';
                $sub_vl = 1;
            } else {
                $chk_st = '';
                $sub_vl = 0;
            }
        }
        if (!function_exists('dbConnect')) include_once 'dblib.inc.php';
        include_once 'config.php';
        $db = dbConnect();
        $u_sql    =    "UPDATE `session_trap` SET `s_shw`=$sub_vl,`s_chk`='$chk_st' ".
                    "WHERE (`s_uid`=$c_cid AND `s_name`='$sesNameID');";
        $u_res  =    dbExec($u_sql);
        $u_res  =    dbExec('COMMIT');
        if ($sub_vl==1) {
           include 'proc_last.php';  // Create temp table 'last_order'
        } else {
            $d_res      =  dbExec("DROP TABLE IF EXISTS `last_order`;");
           }
    What doesn't work right in IE is the var setting that toggles the values, so either the "include 'proc_last.php';" or the "DROP TABLE" statements work right. IE processes in a way that always causes the box to get "checked" so the "include 'proc_last.php';" is always called. I've tried many other combinations to try changing this up, but nothing has worked so far.

    If you put in:
    echo "C=> $chk_st S=> $sub_vl <br>";
    just before the "if (!function_exists('dbConnect'))" you will see the state of the vars never change in IE processing, but do change in FF and Safari.

    I also played around with other code for another scenario where buttons have to process exclusively, which doesn't work at all for checkboxes, but supposed to work with radio buttons. I had found a resource at:

    http://www.skytopia.com/project/arti...psci/form.html

    which had examples that helped me a lot and got me messing with this scenario.

    Here is my code for that, but it also does not work right.
    Code:
    <?php
    if(isset($_POST) && !empty($_POST)){
        foreach($_POST as $key => $val) {
           echo "K=> $key V=> $val <br>";
        }
    }
    $cb_1 = $_POST['cb1'];
    $cb_2 = $_POST['cb2'];
    echo "1=> $cb_1 2=> $cb_2 <br>";
    if ($cb_1=='' && $cb_2=='cb2Value') {
       $cb_1 = 'checked';
       $cb_2 = '';
       $tb_val = 'Check One';
    } else {
       $cb_1 = '';
       $cb_2 = 'checked';
       $tb_val = 'Check Two';
    }
    ?>
    </STYLE>
    <script type="text/javascript">
       function Set_Checked(type) {
          document.getElementById("cb1").style.display = "none"
          document.getElementById("cb2").style.display = "none"
          document.getElementById(type).style.display = ""
          this.form.submit()
       }
    </script>
    <br />
    <br />
    <form method="post" action="?" name="theForm">
    <input type="radio" name="cb1" value="cb1Value" onClick="document.theForm.submit()"
       <?php echo $cb_1; ?> />CB1<br />
    <input type="radio" name="cb2" value="cb2Value" onClick="document.theForm.submit()"
       <?php echo $cb_2; ?> />CB2<br />
    <input type="text" name="tb1" value="<?php echo $tb_val; ?>" />
    </form>
    It works correctly if I click CB2 on and off, but never works for CB1. This example just changes the value of the input field.

    The purpose of getting this form working is so I can create a form to exclusively bring in an IFRAME containing a report, but based on which button is selected change which report the IFRAME shows.

    Thanks!

    Appreciated your help, got me thinking about things a little differently.

    OMR


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
  •