Hello Everyone,
  I hope your weekend is going well, or went well if you're reading this on 
your Monday!

  I'm trying to create forms that will work with Tabs, and Yes, I am following 
the Tab.js example that ships with Qooxdoo.  I was able to get the example 
Form.js file to work with the Tab.js example.  So I figured it was time to get 
my own forms going.

  Here is the Form.js example that I am following:

https://github.com/qooxdoo/qooxdoo/blob/master/application/mobileshowcase/source/class/mobileshowcase/page/Form.js

  Here are the errors that I'm getting in Chrome console log:
begin ContactInfoView _initialize() openemergencymobile.js:209
begin ContactInfoView __createForm() openemergencymobile.js:209
end ContactInfoView __createForm() openemergencymobile.js:209
  ContactInfoView _initialize() after getContent().add() 
openemergencymobile.js:209
  ContactInfoView _initialize() submit button openemergencymobile.js:209
  ContactInfoView _initialize() clear button openemergencymobile.js:209
Uncaught TypeError: Object #<HTMLDivElement> has no method 'add' 
openemergencymobile.js:209
Uncaught TypeError: Object [object Object] has no method 'isRootWidget' 
openemergencymobile.js:209

  I'm getting similar errors in Firefox's console log also.

  Here is my own form:
// License:  AGPL
// Copyright:  Harlan H. Bloom, 2001-2013
qx.Class.define("openemergencymobile.view.ContactInfoView",
{
    extend : qx.ui.mobile.page.NavigationPage,

    construct : function()
    {
        this.base(arguments);
        this.setTitle("Contact Info");

    }, // end construct()

    members :
    {
        __clearButton : null,
        __contactTypeCombo : null,
        __form : null,
        __numberEmailText : null,
        __submitButton : null,

        // overridden
        _initialize : function()
        {
console.log("begin ContactInfoView _initialize()");
            this.base(arguments);
            this.__form = this.__createForm();
            this.getContent().add(new 
qx.ui.mobile.form.renderer.Single(this.__form));
console.log("  ContactInfoView _initialize() after getContent().add()");

            // Submit & Clear Buttons
console.log("  ContactInfoView _initialize() submit button");
            this.__submitButton = new qx.ui.mobile.form.Button("Submit");
            this.__submitButton.addListener("tap", this._onSubmitButtonTap, 
this);
            this.__submitButton.setEnabled(false);
            this.getContent().add(this.__submitButton);

console.log("  ContactInfoView _initialize() clear button");
            this.__clearButton = new qx.ui.form.Button("Clear");
            this.__clearButton.addListener("tap", this._onClearButtonTap, this);
            this.__clearButton.setEnabled(false);
            this.getContent().add(this.__clearButton);
            
console.log("end ContactInfoView _initialize()");
        }, // end initialize()


        /**
         *
         */
        __createForm : function()
        {
console.log("begin ContactInfoView __createForm()");
            var form = new qx.ui.mobile.form.Form();
            var validationManager = form.getValidationManager();

            // Number/Email address
            this.__numberEmailText = new 
qx.ui.mobile.form.TextField().set({placeholder:"Number/Email"});
            this.__numberEmailText.setRequired(true);

            form.addGroupHeader("Contact Info");
            form.add(this.__numberEmailText, "Number/Email");

            var contactTypeModel = new qx.data.Array(["Home Phone", "Cell 
Phone", "Work Phone", "Home Email", "Work Email"]);
            var contactTypeLabel = "Type";
            this.__contactTypeCombo = new qx.ui.mobile.form.SelectBox();
            this.__contactTypeCombo.set({required: true});
            this.__contactTypeCombo.set({placeholder:"Unknown"});
            this.__contactTypeCombo.setClearButtonLabel("Clear");
            this.__contactTypeCombo.setNullable(true);
            this.__contactTypeCombo.setDialogTitle(contactTypeLabel);
            this.__contactTypeCombo.setModel(contactTypeModel);
            this.__contactTypeCombo.setSelection(null);

            form.add(this.__contactTypeCombo, contactTypeLabel);

console.log("end ContactInfoView __createForm()");
            return (form);
        }, // end __createForm()

        /**
         * Event handler for Submit button.
         *
         * @param evt {qx.event.type.Tap} The tap event.
         */
        _onSubmitButtonTap : function()
        {
          if(this.__form.validate())
          {
            var result = [];
            result.push(this.__numberEmailText.getValue());
            result.push(this.__contactTypeCombo.getValue());
          } else {
            // Scroll to invalid field.
            var invalidItems = this.__form.getInvalidItems();
            this.scrollToWidget(invalidItems[0].getLayoutParent(), 500);
          }
        }, // end _onSubmitButtonTap()

        /**
         * Event handler for Clear button.
         *
         * @param evt {qx.event.type.Tap} The tap event.
         */
        _onClearButtonTap : function()
        {
            this.__numberEmailText.setValue("");
            this.__contactTypeCombo.setValue("");
        } // end _onClearButtonTap()

    } // end members
});

  I'm sorry this so long, but I have no idea where to find the error, 
especially since I used Form.js as the pattern for my form.

Thank You for your time,

Harlan...


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to