Changeset 353 for trunk/examples


Ignore:
Timestamp:
09/28/05 13:06:16 (14 years ago)
Author:
gocher
Message:

javascript error handler for ext_example, and two little mistakes

Location:
trunk/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/ext_example-body.html

    r337 r353  
    1515 
    1616  <script type="text/javascript"> 
     17    function showError( sMsg, sUrl, sLine){ 
     18      document.getElementById('errors').value += 'Error: ' + sMsg + '\n' + 
     19                                                 'Source File: ' + sUrl + '\n' + 
     20                                                 'Line: ' + sLine + '\n'; 
     21      return false; 
     22    } 
     23    window.onerror = showError; 
     24    document.onerror = showError; 
     25 
    1726    var f = window.parent.menu.document.forms[0]; 
    1827    // You must set _editor_url to the URL (including trailing slash) where 
     
    161170      //check submitted values 
    162171      var submit = document.createElement('button'); 
    163       submit.type = "submit"; 
     172      submit.setAttribute('type', 'submit'); //submit.type = "submit"; 
    164173      submit.innerHTML = "Submit"; 
    165174      b.appendChild(submit); 
     
    172181<body> 
    173182  <form id="editors_here" method="post" action="ext_example-dest.php"> 
    174  
     183  <!-- <textarea id="errors" style="width:100%; height:100px; background:silver;display:none;"></textarea> --> 
    175184  </form> 
     185  <textarea id="errors" style="width:100%; height:100px; background:silver;"></textarea> 
    176186<script type="text/javascript"> 
    177187    var _oldSubmitHandler = null; 
  • trunk/examples/ext_example-dest.php

    r337 r353  
    88<?php 
    99if (get_magic_quotes_gpc()) { 
    10    $_REQUEST = array_map('stripslashes',$_REQUEST); 
     10  $_REQUEST = array_map('stripslashes',$_REQUEST); 
    1111} 
    12         foreach($_REQUEST as $key=>$value){ 
    13           if(substr($key,0,10) == 'myTextarea') { 
     12// or in php.ini 
     13//; Magic quotes for incoming GET/POST/Cookie data. 
     14//magic_quotes_gpc = Off 
     15  foreach($_REQUEST as $key=>$value){ 
     16    if(substr($key,0,10) == 'myTextarea') { 
    1417      echo '<h3 style="border-bottom:1px solid black;">'.$key.'(source):</h3><xmp style="border:1px solid black; width: 100%; height: 200px; overflow: auto;">'.$value.'</xmp><br/>'; 
    15                         echo '<h3 style="border-bottom:1px solid black;">'.$key.'(preview):</h3>'.$value; 
     18      echo '<h3 style="border-bottom:1px solid black;">'.$key.'(preview):</h3>'.$value; 
    1619    } 
    1720  } 
Note: See TracChangeset for help on using the changeset viewer.