Changeset 12261

Show
Ignore:
Timestamp:
02/02/08 22:19:36 (11 months ago)
Author:
doughays
Message:

Fixes #5746. Grab encType from srcNodeRef for IE. Added file upload form test but encType must be specified as multipart/form-data for this to work.

Location:
dijit/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/form/Form.js

    r12183 r12261  
    251251                action: "", 
    252252                method: "", 
    253                 enctype: "multipart/form-data", 
     253                encType: "", 
    254254                "accept-charset": "", 
    255255                accept: "", 
     
    259259 
    260260                attributeMap: dojo.mixin(dojo.clone(dijit._Widget.prototype.attributeMap), 
    261                         {onSubmit: "", action: "", method: "", enctype: "", "accept-charset": "", accept: "", target: ""}), 
     261                        {onSubmit: "", action: "", method: "", encType: "", "accept-charset": "", accept: "", target: ""}), 
    262262 
    263263                // execute: Function 
     
    268268                //      Deprecated: use onSubmit 
    269269                onExecute: function(){}, 
     270 
     271                postCreate: function(){ 
     272                        // IE tries to hide encType 
     273                        if(dojo.isIE && this.srcNodeRef && this.srcNodeRef.attributes){ 
     274                                var item = this.srcNodeRef.attributes.getNamedItem('encType'); 
     275                                if(item && (typeof item.value == "string")){ 
     276                                        this.setAttribute('encType', item.value); 
     277                                        this.domNode.encoding = item.value; 
     278                                } 
     279                        } 
     280                        this.inherited(arguments); 
     281                }, 
    270282 
    271283                // TODO: remove ths function beginning with 2.0 
  • dijit/trunk/tests/form/Form.html

    r12232 r12261  
    107107<div style="color:red">Currently only widgets are supported, not raw elements.</div> 
    108108<!--    to test form submission, you'll need to create an action handler similar to 
    109         http://www.utexas.edu/teamweb/cgi-bin/generic.cgi --> 
    110 <form dojoType="dijit.form.Form" id="myForm" onsubmit="alert('Attempting to submit form w/values:\n'+dojo.toJson(this.getValues(),true));if(this.isValid()){return confirm('Form is valid, press OK to submit');}else{alert('Form contains invalid data.  Please correct first');return false;}"> 
     109        http://www.utexas.edu/teamweb/cgi-bin/generic.cgi  
     110        http://www.tipjar.com/cgi-bin/test --> 
     111<form dojoType="dijit.form.Form" id="myForm" encType="multipart/form-data" action="" method="" onsubmit="alert('Attempting to submit form w/values:\n'+dojo.toJson(this.getValues(),true));if(this.isValid()){return confirm('Form is valid, press OK to submit');}else{alert('Form contains invalid data.  Please correct first');return false;}"> 
    111112<p>Just HTML text</p> 
    112113<table border=2> 
     
    259260</tr> 
    260261 
     262<tr> 
     263<td>File upload</td><td>filename</td> 
     264<td> 
     265<input dojoType="dijit.form.TextBox" name="filename" type="file"> 
     266</td> 
     267</tr> 
    261268</table> 
    262269