2010年2月5日星期五

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

I have an instance of Zend_Dojo_Form that I use to update my online
inventory. All of the form fields are dijits and

var values = diji.byId('myForm').attr('value');

...does indeed collect all of the values as a js object. However, the
value of the Editor is not included. Looking at the markup, there is a
hidden input with the id specified in the form ('features'), and the
actual textarea element has an id of "features-Editor". So, I have
this bit of code to make sure I have all of the form values for the
xhr payload:

var values = diji.byId('myForm').attr('value');
values.features = diji.byId('features-Editor').attr('value');

...and now I have all of the values of the form elements.

I haven't done it yet, but I am assuming that POSTing the form via
HTTP will include all of the form values, at which point I can call
$form->getValues() and have access to everything. But since the form,
like many others I have designed, is being submitted via xhr, is the
behavior noted above intended, or a by-product of getting the Editor
widget to work via Zend_Dojo_Form and it's dijit decorators? I've run
into this "issue" a few times now and finally decided to ask about it.
I guess what I'm saying is that I would really like the statement

var values = diji.byId('myForm').attr('value');

...to always give all the form values from a Zend_Dojo_Form. Am I just
being lazy or am I not doing something right?

regards,

Nathan Garlington
T&R Trailer Sales
5930 N Interstate 25
Pueblo, CO 81008

719.546.2321 T
719.423.8033 M
719.404.4697 F

nathan@tandrtrailer.com
www.tandrtrailer.com

没有评论: