DHTMLX Docs & Samples Explorer

Events


Log (clear)
Source
<link rel="stylesheet" type="text/css" href="../../codebase/skins/dhtmlxform_dhx_skyblue.css">
    <script src="../../codebase/dhtmlxcommon.js"></script>
    <script src="../../codebase/dhtmlxform.js"></script>
    <script src="../../codebase/ext/dhtmlxform_item_upload.js"></script>
    <script src="../../codebase/ext/swfobject.js"></script>
    <style>
        div#simpleLog {
            width: 800px;
            height: 200px;
            font-family: Tahoma;
            font-size: 11px;
            overflow: auto;
        }
    </style>
    <script>
var myForm,
formData,
logObj;
function doOnLoad() {
    formData = [{
        type: "fieldset",
        label: "Uploader",
        list: [{
            type: "upload",
            name: "myFiles",
            mode: "flash",
            inputWidth: 330,
            url: "php/dhtmlxform_item_upload.php",
            swfPath: "../../codebase/ext/uploader.swf",
            swfUrl: "../../samples/07_uploader/php/dhtmlxform_item_upload.php"
        }]
        }];
    myForm = new dhtmlXForm("myForm", formData);
    myForm.attachEvent("onUploadFile", function(realName, serverName) {
        logEvent("<b>onUploadFile</b>, real name: " + realName + ", server name: " + serverName);
    });
    myForm.attachEvent("onUploadComplete", function(count) {
        logEvent("<b>onUploadComplete</b> " + count + " file" + (count > 1 ? "s were": " was") + " uploaded");
    });
    myForm.attachEvent("onUploadCancel", function(realName) {
        logEvent("<b>onUploadCancel</b>, file: " + realName);
    });
    myForm.attachEvent("onUploadFail", function(realName) {
        logEvent("<b>onUploadFail</b>, file: " + realName);
    });
    myForm.attachEvent("onFileAdd", function(realName) {
        logEvent("<b>onFileAdd</b>, real name: " + realName);
    });
    myForm.attachEvent("onFileRemove", function(realName, serverName) {
        logEvent("<b>onFileRemove</b>, real name: " + realName + ", server name: " + (serverName == null ? "wasn't uploaded": serverName));
    });
    myForm.attachEvent("onClear", function() {
        logEvent("<b>onClear</b>");
    });
}
function logEvent(t) {
    if (!logObj)
        logObj = document.getElementById("simpleLog");
    logObj.innerHTML += t + "<br>";
}
function clearLog() {
    if (!logObj)
        logObj = document.getElementById("simpleLog");
    logObj.innerHTML = "";
}
</script> <table> <tr><td><div id="myForm"></div></td></tr> <tr><td><br><b>Log (<a href="javascript:void(0);" onclick="clearLog();">clear</a>)</b></td></tr> <tr><td><div id="simpleLog"></div></td></tr> </table>