dojox/form/FileInput.js

  • Provides:

    • dojox.form.FileInput
  • Requires:

    • dijit.form._FormWidget in common in project dijit
    • dijit._Templated in common in project dijit
  • dojox.form.FileInput

    • type
      Function
    • chains:
      • dijit.form._FormWidget: (prototype)
      • dijit.form._FormWidget: (call)
    • summary
      A styled input type="file"
    • description
      A input type="file" form widget, with a button for uploading to be styled via css,
      a cancel button to clear selection, and FormWidget mixin to provide standard dijit.form.Form
      support (FIXME: maybe not fully implemented)
  • dojox.form.FileInput.label

    • type
      String
    • summary
      the title text of the "Browse" button
  • dojox.form.FileInput.cancelText

    • type
      String
    • summary
      the title of the "Cancel" button
  • dojox.form.FileInput.name

    • type
      String
    • summary
      ugh, this should be pulled from this.domNode
  • dojox.form.FileInput.templateString

    • summary
  • dojox.form.FileInput.startup

    • type
      Function
    • source: [view]
        this._listener = this.connect(this.fileInput,"onchange","_matchValue");
        this._keyListener = this.connect(this.fileInput,"onkeyup","_matchValue");
    • summary
      listen for changes on our real file input
  • dojox.form.FileInput.postCreate

    • type
      Function
    • source: [view]
      }
    • summary
  • dojox.form.FileInput._matchValue

    • type
      Function
    • source: [view]
        this.inputNode.value = this.fileInput.value;
        if(this.inputNode.value){
         this.cancelNode.style.visibility = "visible";
         dojo.fadeIn({ node: this.cancelNode, duration:275 }).play();
        }
    • summary
      set the content of the upper input based on the semi-hidden file input
  • dojox.form.FileInput.setLabel

    • type
      Function
    • parameters:
      • label: (typeof String)
      • cssClass: (typeof String)
    • source: [view]
        this.titleNode.innerHTML = label;
    • summary
      method to allow use to change button label
  • dojox.form.FileInput.reset

    • type
      Function
    • parameters:
      • e: (typeof Event)
    • source: [view]
        this.disconnect(this._listener);
        this.disconnect(this._keyListener);
        if(this.fileInput){
         this.domNode.removeChild(this.fileInput);
        }
        dojo.fadeOut({ node: this.cancelNode, duration:275 }).play();


        // should we use cloneNode()? can we?
        this.fileInput = document.createElement('input');
        // dojo.attr(this.fileInput,{
        // "type":"file", "id":this.id, "name": this.name
        //});
        this.fileInput.setAttribute("type","file");
        this.fileInput.setAttribute("id", this.id);
        this.fileInput.setAttribute("name", this.name);
        dojo.addClass(this.fileInput,"dijitFileInputReal");
        this.domNode.appendChild(this.fileInput);


        this._keyListener = this.connect(this.fileInput, "onkeyup", "_matchValue");
        this._listener = this.connect(this.fileInput, "onchange", "_matchValue");
        this.inputNode.value = "";
    • summary
      on click of cancel button, since we can't clear the input because of
      security reasons, we destroy it, and add a new one in it's place.
  • dojox.form.FileInput._listener

    • summary
  • dojox.form.FileInput._keyListener

    • summary
  • dojox.form.FileInput.inputNode.value

    • summary
  • dojox.form.FileInput.cancelNode.style.visibility

    • summary
  • dojox.form.FileInput.titleNode.innerHTML

    • summary
  • dojox.form.FileInput.fileInput

    • summary
  • dojox.form

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary