(on Thursday, 25 September 2008, 11:31 AM +0200):
> I have a problem with the dojo editor, how is it possible to get the input of
> the dojo editor ?
Are you using the Editor from trunk or from my blog? It makes a
difference -- the one from trunk is more recent and fully tested.
I've populated and pulled content from it just fine on my end; the only
thing I can think of is that you weren't using the Dojo form decorator
for your form -- which would mean that the onsubmit event that populates
the hidden editor element would not trigger.
> Here's my code element :
>
> $this->addElement(
> 'editor',
> 'content',
> array(
> 'editActionInterval' => 2,
> 'focusOnLoad' => true,
> 'height' => '250px',
> 'styleSheets' => array('/js/custom/editor.css'),
> ));
>
>
> I build my form and tried to access the elements :
> echo "Content : " . $form->getValue('content');
> echo "title : " . $form->getValue('title');
>
> I have something for the title but nothing for the editor's content.
>
> I checked the html :
> <input id="content" name="content" value="" type="hidden">
> <textarea id="content-Editor" name="content[Editor]" type="text"></textarea>
>
> So I changed 'content' to 'content[Editor]' but I got nothing.
Not necessary -- the Editor view helper actually attaches an event to
the form's onsubmit hook that then populates the hidden element with the
content of the Editor. (If you look in Firebug, the <textarea> actually
disappears when the Editor dijit is created, which is why this is
necessary.)
> One other thing, when using the form->validation, if one element does't
> validate, the content of the form is not redisplayed when using
>
> if(!$form->isValid($formData) )
> $form->populate($formData);
You don't need to populate() the form after calling isValid() -
isValid() does that for you.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论