[Zope] Display Success Message if file is uploaded successfully.. HELP!

Tino Wildenhain tino at wildenhain.de
Mon Jan 5 08:06:52 EST 2004


Thierry Florac schrieb:
> On Monday 05 January 2004 07:27, cheng saimun wrote:
> 
>>Hi
>>
>>I have a form which allows user to upload a file and then click submit.
>>This will lead to a dtml-method which will prefom a series of manipulation.
>>After this is done, this method will need to return to the previous page(
>>ie. form ). My question is how do i add a 'UPLOAD SUCCESSFUL' message in
>>this form if the file is uploaded? I mean when the user first enters this
>>form, he should not see the message. Only when the successful uploading
>>will he see it.
> 
> 
> 
>   Hi,
> 
> I think two ways are available to handle this :
> 
>   1. make a redirection at the end of your DTML method, adding a parameter 
> (for example, upload=1) saying that upload was OK. In your first form, you 
> just have to check for this parameter and display a message accordingly 
> (<dtml-if upload>...</dtml-if>).
> 
>   2. I generally handle forms actions with Python scripts. At the end of these 
> scripts, I add a volatile attribute to my object (self._v_modified=1) and in 
> my DTML forms, I check for this attribute : if it exists, I display a message 
> and then delete it immediately...
What is DTML? ;))
Btw. if you set the attribute, every user viewing the resource
at this time will see the message. I dont think this is what
one wants.

Instead of redirecting or other magic its just easy to either
place a value in REQUEST or call the template with
another parameter to indicate this. Of use a seperate
template with different layout if desireable


Regards
Tino Wildenhain




More information about the Zope mailing list