So...this is weird,

I had removed the 'echo $form->elementName->renderLabel()' calls from my
view script and was putting some regular 'ol html in place of the labels
(for now), after reading your response I go back, un-comment the foreach
loop at the top of my view script, add a new 'renderLabel()' (like above)
to some elements and all of a sudden it works now.

I like things to work, but I hate it when things just start working...this
tells me nothing about what was happening before.

If you would like to try it too, please post back with your results. I did
nothing significant between posting here...

Thanks though, I would like to figure out what happened
(BTW, this may double post...Nabble is being weird about letting me post
via the web interface)

On Thu, Jan 19, 2012 at 6:18 PM, Clint Lenard <[email protected]>wrote:

> I haven't tried a foreach loop, but I have had success in removing the dt
> tags from MOST of the form elements... well, everything other than Submit,
> by using:
>
> ->removeDecorator('htmlTag');
>
> or
>
> ->removeDecorator('DtDWrapper');
>
> Of course, I simply use these on the form elements, like so:
>
>         $pswd = new Zend_Form_Element_Password('pswd');
>         $pswd->setAttrib('size', 35)
>              ->removeDecorator('htmlTag');
>
>         $submit = new Zend_Form_Element_Submit('submit');
>         $submit->setLabel('Login')
>                ->removeDecorator('DtDWrapper');
>
> Since you're using a foreach loop - have you tried getElement() instead of
> getElements() ?
>
> Just curious. I'm interested in seeing a solution for this, too.
>
> On Thu, Jan 19, 2012 at 4:55 PM, Rob Haag <[email protected]> wrote:
>
>> Hi,
>>
>> I am attempting to get my forms to have no html tags, I have attempted in
>> several ways, some came from here...
>> http://mwop.net/blog/215-Rendering-
>> Zend_Form-decorators-individually<http://mwop.net/blog/215-Rendering-Zend_Form-decorators-individually>(O'Phinney's
>>  site),
>>
>> from that site I attempted the 'foreach' loop in my view script like so...
>>
>> foreach ($form->getElements() as $element) {
>>                           $element->getDecorator('label')->setTag(null);
>>                        }
>>
>> resulting in a "Call to a member function setTag() on a non-object" error,
>> as the same happens if I do this...
>>
>>        $this->removeDecorator('HtmlTag');
>>        foreach ($this->getElements() as $element) {
>>            $element->addDecorator('Label');
>>            $element->getDecorator('Label')->setTag(null);
>>            $element->removeDecorator('HtmlTag');
>>            $element->removeDecorator('DtDdWrapper');
>>
>>        }
>>
>> after all of my 'addElement' code in my form class (extends Zend_Form).
>>
>> If I put the above code at the top of my init() function, it does nothing
>> at all...my labels still have the '<dt>' tags rendering like so...
>>
>>  <dt id="date-label"><label for="date" class="optional">Date
>> (DD/MM/YYYY):</label></dt>
>>
>> I am trying to have no tags at all so I can call each element individually
>> in my veiw script and manipulate the form to my requirements, plus adding
>> <hr /> tags, etc.
>>
>> Is there still a bug with setTag() ? do I have to add a decorator first,
>> then remove it? I'm a bit baffled on this one...
>>
>> Thanks
>>
>
>
>
> --
> Thanks,
>
> Clint Lenard
>
> www.ClintLenard.com
> www.Affiliit.com
>
> *"Great minds discuss ideas*, *average minds discuss events*, *small
> minds discuss people*." - Eleanor Roosevelt
>
> *"**I've learned that mistakes can often be as good a teacher as success.*"
> - Jack Welch
>
>

Reply via email to