2010年2月7日星期日

Re: [fw-mvc] Zend_Dojo - How to get the value of an Editor dijit

-- Nathan Garlington <garlinto@gmail.com> wrote
(on Saturday, 06 February 2010, 01:03 PM -0700):
> I haven't extended dijit.form.Form yet, but I have done something
> simpler: in the dojo.connect() that listens for the form submit, I
> check for a valid form as well as a valid Editor field and take action
> depending on the results. While I feel fairly proficient at writing
> dojo apps (hardly consult the api reference anymore), I haven't tried
> extending any dojo widgets yet, although I suppose that task isn't as
> arduous as I am making it out to be in my head. I suppose that if I
> did that, I would then have a reusable form widget that I could plugin
> any time I needed to have the Editor in a form....something to think
> about.

Extending Dijits or writing your own is actually really, really easy,
and dojocampus has a nice "quick start" to writing them:

http://docs.dojocampus.org/quickstart/writingWidgets

That page also has a reference section towards the bottom that has some
great links.

The main thing to realize is that all widgets have the same API: you
pass an object of parameters to mixin to the widget, and then optionally
a DOM node that will be replaced with the new widget:

var widget = new some.Widget(params, node);

Widgets themselves typically will provide either a template string, or
the path to a file containing the template, and optionally some
behavior; there's a whole widget lifecycle that you can tie into in
order to do customization. Once you know the basics and write one or
two, you'll likely find you have trouble finding situations where
they're _not_ applicable; they're really that easy.

Have fun!

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

没有评论: