2008年8月9日星期六

Re: [fw-mvc] Dojo ZF Form decorator


>On Sat, Aug 9, 2008 at 1:59 PM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
> A decorator would be ideal for this. Unfortunately, I can't give any
> more feedback than this without knowing what sort of markup you'd like
> to generate, and what elements of that markup can be derived from the
> element metadata. So, send another email with more specifics, and we'll
> see what we can come up with.
>

Great thanks Mathew, I'd imagine lots of people would like to do this so hopefully it will be helpful to all.

A quick look at the Dojo book I picked up in preparation for the new version of ZF tells me that I'm trying to produce an "anchor tooltip" where by a tooltip becomes visible by hovering an element. In this case, hovering an image icon that will appear to the right of a form field, or in one case a set of fields derived from a subform. The text I want in there is the element description meta data usually appended into a form using the Description decorator. So on with the form markup!

I'd like my final markup to look something like this:

<form>
<label>My label: </label>
<input />
<img>  <--- reacts to on hover to reveal tooltip
<p class="hint">Tool Tip<p>

<div id="subform">
<label>My label: </label>
<input />
</div>
<img> <--- reacts to on hover to reveal tooltip
<p class="hint">Tool Tip<p>
</form>

I'm guessing that this means that I need to decorate form elements within the main form with an image tag that has an ID that Dojo can "connect" the tooltip to? From there the "Description" decorator gets modified / changed to be a Dojo ToolTip element that references the ID of the image? And similarly with the subform, apply a form level decorator that does the same, but pulling in the SubForm description META data?

My understanding of this is that I don't need to use Zend_Form_Dojo here, but to just change my existing forms somehow?

Cheers,

Steve

------------

> -- Steven <gatecrasher1981@gmail.com> wrote
> (on Saturday, 09 August 2008, 12:39 PM +0100):
>> Quick question on the best implementation approach for the following.
>>
>> I've a Zend Form that implements the decorator that appends a
>> paragraph tag after a form element with the class 'hint' - currently
>> hidden via CSS, I'm aiming to implement this with Dojo's tooltip dijit
>> functionality. My favoured method would be to decorate the form
>> elements with an image that apears after the elements (might be best
>> to do this with CSS?) and have an onclick event associated to call
>> dojo and display the tooltip (i.e. the paragraph tag).
>>
>> However despite reading the docs several times I'm now feeling rather
>> stupid as I still can't figure out the best way to implement this, so
>> I'm hoping for any pointers in the right direction?



没有评论: