Opened 13 years ago

Closed 13 years ago

#1352 closed enhancement (wontfix)

Hooking Converters and Validators to Widgets

Reported by: ole_ersoy@… Owned by: bill
Priority: high Milestone: 0.9
Component: Widgets Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

Overview:

I've put together a real working example for adding validators to widgets, and the code is attached.

The purpose of this to create reusable widget validators and value converters and enable widget users to call validate() or convert() on a widget before interacting with / sending data to the server. Any number of validators and / or converters can be added to the widget. Their convert or validate method will be called by the widget's validate() or convert() method.

I'll give a quick mockup example for widget validators, but the same thing applies for converters.

dojo.widget.createWidget("myWidget", {}); v=new SpecialValidator?(); v2 = new AnotherSpecialValidator?();

myWidget.addValidator(v); myWidget.addValidator(v2);

myWidget.validate();

So myWidget has a validators[] array that stores a number of validators.

It would be great if this property found a home on Widget, and if Widget had the methods validate() and convert() (Of which validate() is shown on the included code samples)

If more than one converter were hooked up, then my assumption would be that this is on purpose and that the output of one conversion is an input into the next.

Please contact me if you have any questions: ole_ersoy@…

Cheers,

  • Ole

Attachments (4)

testMyWidget.html (1.5 KB) - added by guest 13 years ago.
Validators.js (782 bytes) - added by guest 13 years ago.
MyWidget.js (929 bytes) - added by guest 13 years ago.
Exceptions.js (126 bytes) - added by guest 13 years ago.

Download all attachments as: .zip

Change History (6)

Changed 13 years ago by guest

Attachment: testMyWidget.html added

Changed 13 years ago by guest

Attachment: Validators.js added

Changed 13 years ago by guest

Attachment: MyWidget.js added

Changed 13 years ago by guest

Attachment: Exceptions.js added

comment:1 Changed 13 years ago by dylan

Milestone: 0.5
Version: 0.40.3

comment:2 Changed 13 years ago by bill

Resolution: wontfix
Status: newclosed

I think this is mainly addressed by the SerializableTextbox? and ValidationTextbox?, which do both conversions and validation. If you need something more powerful please build something against the new Dijit infrastructure and put in Dojox (but talk to Tom Trenka first to see if he wants to add that)

Note: See TracTickets for help on using tickets.