I would keep the image separate from the form unless you have a good reason
not to. Then the logic is simple. Display the image if it exists, if not
then display the form. Of course you would need an action to delete the
image so that the form could be redisplayed.


Edward Haber wrote:
> 
> Definitely view logic. Good call. Still I'm uncertain though because  
> I'm working with an extended Zend_Form class. Perhaps I should make a  
> custom Form Element? Or a custom Form Decorator? Or use the view  
> helper decorator for just that element? I'd love to hear the Zend best  
> practice take on this solution.
> 
> Thanks!
> 
> 
> 
> On Oct 2, 2008, at 10:50 PM, Matthew Lurz wrote:
> 
>>
>> Sounds like view logic to me and so I would add a conditional in the  
>> view
>> script.
>>
>>
>> Edward Haber wrote:
>>>
>>> I have a form that I want offer an image upload form element on. This
>>> has worked great using Zend_Form_Element_File. The upload works fine.
>>> What is the recommended way to have the uploaded image replace the
>>> upload form if an image exists? I don't need the solution coded, just
>>> the direction I should go.
>>>
>>> For example, I have the form as a class. SHould I pass the image name
>>> (if one exists) in the config array to the form? In the form i would
>>> then check for $config['imageName'] and if it exists display the  
>>> image
>>> in place of the form element. This is another trick - how do display
>>> an image in a form?
>>>
>>> Is the answer toggling in the form class between the form element and
>>> an image? Or using CSS to display the image if it's there and "hide"
>>> the form (display:none for example).
>>>
>>> I'm just looking for best practice. I'm sure lots of people have
>>> already confronted this situation. Any input much appreciated!  
>>> Thanks!
>>>
>>> Eddie
>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Toggle-file-upload-element-with-uploaded-image-tp19780259p19791263.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Toggle-file-upload-element-with-uploaded-image-tp19780259p19796584.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to