Changeset 974

Show
Ignore:
Timestamp:
12/21/06 20:09:09 (2 years ago)
Author:
bchoate
Message:

Restrict width field to numeric characters. BugId: 45991

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/tmpl/cms/asset_image_options.tmpl

    r970 r974  
    4444} 
    4545 
     46function widthKeyPress(e) { 
     47    var key; 
     48    if (window.event) { 
     49        key = window.event.keyCode; 
     50        e = window.event; 
     51    } else if (e) 
     52        key = e.which; 
     53    else 
     54        return true; 
     55    if (( key == null) || ( key == 0 ) || ( key == 8 ) ||  
     56        ( key == 9 ) || ( key == 13 ) || ( key == 27 )) 
     57        return true; 
     58    if (key > 60000) // handles range of special keys such as arrow keys 
     59        return true; 
     60    if (e.ctrlKey || e.altKey) 
     61        return true; 
     62    if ((e.charCode < 48) || (e.charCode > 57)) 
     63        return TC.stopEvent(e); 
     64    return true; 
     65} 
     66 
    4667//--> 
    4768</script> 
     
    6586            <p><input type="checkbox" name="thumb" value="1" <TMPL_IF NAME=MAKE_THUMB>checked="checked" </TMPL_IF>/> <MT_TRANS phrase="Create Thumbnail"> <a href="#" onclick="return openManual('file_upload', 'creating_thumbnails')" class="help">?</a> 
    6687            <label for="thumb_width"><MT_TRANS phrase="Width">:</label> 
    67             <input name="thumb_width" id="thumb_width" value="<TMPL_VAR NAME=THUMB_WIDTH>" onchange="adjustWidthHeight(this.form, 1)" size="4" /> 
     88            <input name="thumb_width" id="thumb_width" value="<TMPL_VAR NAME=THUMB_WIDTH>" onkeypress="widthKeyPress(event)" onchange="adjustWidthHeight(this.form, 1)" size="4" /> 
    6889            <input type="hidden" name="thumb_height" value="<TMPL_VAR NAME=THUMB_HEIGHT>" onchange="adjustWidthHeight(this.form, 0)" size="4" /> 
    6990            <MT_TRANS phrase="Pixels">