Hi,
as chris said, the easiest way is to add a listener to each added element.
For that, you can subclass the qooxdoo form and extend its methods. I have
tested it in the playground and it works like this:
qx.Class.define("MyForm", {
extend : qx.ui.form.Form,
properties : {
dirty : {
check : "Boolean",
init : false
}
},
members : {
add : function(item, label, validator, name) {
this.base(arguments, item, label, validator, name);
item.addListener("changeValue", this.__onChangeValue, this);
},
__onChangeValue : function() {
this.setDirty(true);
},
reset : function() {
this.base(arguments);
this.setDirty(false);
}
}
});
This works for all added item supplying a value property. Most of the
qooxdoo widgets do have a value property. Only those handling a selection
does not have that so you need to extend the code I gave you if you want to
use a SelectBox for example.
Best,
Martin
sub wrote:
>
>
>
> I wanted to check the state of my form to check if there are any modified
> fields before certain actions (EG close app, edit a different row etc).
>
> I was going to have a listener on each field and thought of using the
> hasState, addState methods to track changes. The best simplest way to do
> this was at the form level itself but hasState, addState are only
> available
> for widgets.
>
> It will be quite easy to code up another way of doing this, I just wanted
> to
> hear how others are tackling this as it would be common scenario. Is there
> a
> built in way to do this which I didn't see? If not, would it be a good
> idea
> to include something (form.modified)?
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Easy-way-to-check-if-a-form-is-modified-tp25680632p25680632.html
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register
> now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
--
View this message in context:
http://n2.nabble.com/Easy-way-to-check-if-a-form-is-modified-tp3742548p3747269.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel