dojox/mobile/app/_FormWidget.js

  • Provides:

    • dojox.mobile.app._FormWidget
  • Requires:

    • dojo.window in common in project dojo
    • dijit._WidgetBase in common in project dijit
  • dojox.mobile.app._FormWidget

    • type
      Function
    • chains:
      • dijit._WidgetBase: (prototype)
      • dijit._WidgetBase: (call)
    • summary
      Base class for widgets corresponding to native HTML elements such as <checkbox> or <button>,
      which can be children of a <form> node or a `dojox.mobile.app.Form` widget.
    • description
      Represents a single HTML element.
      All these widgets should have these attributes just like native HTML input elements.
      You can set them during widget construction or afterwards, via `dijit._WidgetBase.attr`.
      
      They also share some common methods.
  • dojox.mobile.app._FormWidget.name

    • type
      String
    • summary
      Name used when submitting form; same as "name" attribute or plain HTML elements
  • dojox.mobile.app._FormWidget.alt

    • type
      String
    • summary
      Corresponds to the native HTML <input> element's attribute.
  • dojox.mobile.app._FormWidget.value

    • type
      String
    • summary
      Corresponds to the native HTML <input> element's attribute.
  • dojox.mobile.app._FormWidget.type

    • type
      String
    • summary
      Corresponds to the native HTML <input> element's attribute.
  • dojox.mobile.app._FormWidget.disabled

    • type
      Boolean
    • summary
      Should this widget respond to user input?
      In markup, this is specified as "disabled='disabled'", or just "disabled".
  • dojox.mobile.app._FormWidget.intermediateChanges

    • type
      Boolean
    • summary
      Fires onChange for each value change or only on demand
  • dojox.mobile.app._FormWidget.scrollOnFocus

    • type
      Boolean
    • summary
      On focus, should this widget scroll into view?
  • dojox.mobile.app._FormWidget.attributeMap

    • summary
  • dojox.mobile.app._FormWidget.postMixInProperties

    • type
      Function
    • source: [view]
      dojo.provide("dojox.mobile.app._FormWidget");
      dojo.experimental("dojox.mobile.app._FormWidget");


      dojo.require("dojo.window");


      dojo.require("dijit._WidgetBase");


      dojo.declare("dojox.mobile.app._FormWidget", dijit._WidgetBase, {
       // summary:
       //  Base class for widgets corresponding to native HTML elements such as or
    • summary
  • dojox.mobile.app._FormWidget.postCreate

    • type
      Function
    • source: [view]
        this.inherited(arguments);
        this.connect(this.domNode, "onmousedown", "_onMouseDown");
    • summary
  • dojox.mobile.app._FormWidget._setDisabledAttr

    • type
      Function
    • parameters:
      • value: (typeof Boolean)
    • source: [view]
        this.disabled = value;
        dojo.attr(this.focusNode, 'disabled', value);
        if(this.valueNode){
         dojo.attr(this.valueNode, 'disabled', value);
        }
    • summary
  • dojox.mobile.app._FormWidget._onFocus

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
        if(this.scrollOnFocus){
         dojo.window.scrollIntoView(this.domNode);
        }
        this.inherited(arguments);
    • summary
  • dojox.mobile.app._FormWidget.isFocusable

    • type
      Function
    • source: [view]
        return !this.disabled && !this.readOnly
         && this.focusNode && (dojo.style(this.domNode, "display") != "none");
    • summary
      Tells if this widget is focusable or not.   Used internally by dijit.
    • tags:
  • dojox.mobile.app._FormWidget.focus

    • type
      Function
    • source: [view]
        this.focusNode.focus();
    • summary
      Put focus on this widget
  • dojox.mobile.app._FormWidget.compare

    • type
      Function
    • parameters:
      • val1: (typeof anything)
      • val2: (typeof anything)
    • source: [view]
        if(typeof val1 == "number" && typeof val2 == "number"){
         return (isNaN(val1) && isNaN(val2)) ? 0 : val1 - val2;
        }else if(val1 > val2){
         return 1;
        }else if(val1 < val2){
         return -1;
        }else{
         return 0;
        }
    • summary
      Compare 2 values (as returned by attr('value') for this widget).
    • tags:
  • dojox.mobile.app._FormWidget.onChange

    • type
      Function
    • parameters:
      • newValue: (typeof )
    • source: [view]
        // summary:
        //  Callback when this widget's value is changed.
        // tags:
        //  callback
    • summary
      Callback when this widget's value is changed.
    • tags:
  • dojox.mobile.app._FormWidget._onChangeActive

    • tags: private
    • type
      Boolean
    • summary
      Indicates that changes to the value should call onChange() callback.
      This is false during widget initialization, to avoid calling onChange()
      when the initial value is set.
  • dojox.mobile.app._FormWidget._handleOnChange

    • type
      Function
    • parameters:
      • newValue: (typeof anything)
        the new value
      • priorityChange: (typeof Boolean)
        For a slider, for example, dragging the slider is priorityChange==false,
        but on mouse up, it's priorityChange==true.  If intermediateChanges==true,
        onChange is only called form priorityChange=true events.
    • source: [view]
        this._lastValue = newValue;
        if(this._lastValueReported == undefined && (priorityChange === null || !this._onChangeActive)){
         // this block executes not for a change, but during initialization,
         // and is used to store away the original value (or for ToggleButton, the original checked state)
         this._resetValue = this._lastValueReported = newValue;
        }
        if((this.intermediateChanges || priorityChange || priorityChange === undefined) &&
         ((typeof newValue != typeof this._lastValueReported) ||
          this.compare(newValue, this._lastValueReported) != 0)){
         this._lastValueReported = newValue;
         if(this._onChangeActive){
          if(this._onChangeHandle){
           clearTimeout(this._onChangeHandle);
          }
          // setTimout allows hidden value processing to run and
          // also the onChange handler can safely adjust focus, etc
          this._onChangeHandle = setTimeout(dojo.hitch(this,
           function(){
            this._onChangeHandle = null;
            this.onChange(newValue);
           }), 0); // try to collapse multiple onChange's fired faster than can be processed
         }
        }
    • summary
      Called when the value of the widget is set.  Calls onChange() if appropriate
    • tags:
  • dojox.mobile.app._FormWidget.create

    • type
      Function
    • source: [view]
      dojo.provide("dojox.mobile.app._FormWidget");
      dojo.experimental("dojox.mobile.app._FormWidget");


      dojo.require("dojo.window");


      dojo.require("dijit._WidgetBase");


      dojo.declare("dojox.mobile.app._FormWidget", dijit._WidgetBase, {
       // summary:
       //  Base class for widgets corresponding to native HTML elements such as or
    • summary
  • dojox.mobile.app._FormWidget.destroy

    • type
      Function
    • source: [view]
        if(this._onChangeHandle){ // destroy called before last onChange has fired
         clearTimeout(this._onChangeHandle);
         this.onChange(this._lastValueReported);
        }
        this.inherited(arguments);
    • summary
  • dojox.mobile.app._FormWidget._onMouseDown

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
      dojo.provide("dojox.mobile.app._FormWidget");
      dojo.experimental("dojox.mobile.app._FormWidget");


      dojo.require("dojo.window");


      dojo.require("dijit._WidgetBase");


      dojo.declare("dojox.mobile.app._FormWidget", dijit._WidgetBase, {
       // summary:
       //  Base class for widgets corresponding to native HTML elements such as or
    • summary
  • dojox.mobile.app._FormWidget.selectInputText

    • type
      Function
    • parameters:
      • element: (typeof DomNode)
      • start: (typeof Number)
      • stop: (typeof Number)
    • source: [view]
      dojo.provide("dojox.mobile.app._FormWidget");
      dojo.experimental("dojox.mobile.app._FormWidget");


      dojo.require("dojo.window");


      dojo.require("dijit._WidgetBase");


      dojo.declare("dojox.mobile.app._FormWidget", dijit._WidgetBase, {
       // summary:
       //  Base class for widgets corresponding to native HTML elements such as or
    • summary
  • dojox.mobile.app._FormWidget.nameAttrSetting

    • summary
  • dojox.mobile.app._FormWidget._lastValue

    • summary
  • dojox.mobile.app._FormWidget._lastValueReported

    • summary
  • dojox.mobile.app._FormWidget._resetValue

    • summary
  • dojox.mobile.app._FormWidget._onChangeHandle

    • summary
  • dojox.mobile.app._FormValueWidget

    • type
      Function
    • chains:
      • dojox.mobile.app._FormWidget: (prototype)
      • dojox.mobile.app._FormWidget: (call)
    • summary
      Base class for widgets corresponding to native HTML elements such as &lt;input&gt; or &lt;select&gt; that have user changeable values.
  • dojox.mobile.app._FormValueWidget.readOnly

    • summary
  • dojox.mobile.app._FormValueWidget.attributeMap

    • summary
  • dojox.mobile.app._FormValueWidget._setReadOnlyAttr

    • type
      Function
    • parameters:
      • value: (typeof Boolean)
    • source: [view]
        this.readOnly = value;
        dojo.attr(this.focusNode, 'readOnly', value);
    • summary
  • dojox.mobile.app._FormValueWidget.postCreate

    • type
      Function
    • source: [view]
        this.inherited(arguments);


        // Update our reset value if it hasn't yet been set (because this.set()
        // is only called when there *is* a value)
        if(this._resetValue === undefined){
         this._resetValue = this.value;
        }
    • summary
  • dojox.mobile.app._FormValueWidget._setValueAttr

    • type
      Function
    • parameters:
      • newValue: (typeof anything)
      • priorityChange: (typeof Boolean, optional)
    • source: [view]
        this.value = newValue;
        this._handleOnChange(newValue, priorityChange);
    • summary
      Hook so attr('value', value) works.
    • description
      Sets the value of the widget.
      If the value has changed, then fire onChange event, unless priorityChange
      is specified as null (or false?)
  • dojox.mobile.app._FormValueWidget._getValueAttr

    • type
      Function
    • source: [view]
        return this._lastValue;
    • summary
      Hook so attr('value') works.
  • dojox.mobile.app._FormValueWidget.undo

    • type
      Function
    • source: [view]
        this._setValueAttr(this._lastValueReported, false);
    • summary
      Restore the value to the last value passed to onChange
  • dojox.mobile.app._FormValueWidget.reset

    • type
      Function
    • source: [view]
        this._hasBeenBlurred = false;
        this._setValueAttr(this._resetValue, true);
    • summary
      Reset the widget's value to what it was at initialization time
  • dojox.mobile.app._FormValueWidget._resetValue

    • summary
  • dojox.mobile.app._FormValueWidget.value

    • summary
  • dojox.mobile.app._FormValueWidget._hasBeenBlurred

    • summary
  • dojox.mobile.app

    • type
      Object
    • summary
  • dojox.mobile

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary