Thanx buddy!!! its working. I will go through the code and go through
Massimo's book and understand why it does not work when using ajax. I still
dont understand the code, but it works now.

Thanx a lot!


On Thu, Apr 25, 2013 at 5:37 PM, Leonel Câmara <[email protected]>wrote:

> It's not working because you're doing something wrong. Probably because
> you're just copy pasting things without thinking.
>
> Here is an example of a working view using it, you can replace {{=form}}
> with your LOAD.
>
> {{extend 'layout.html'}}
> {{block head}}
> <script src="http://malsup.github.com/jquery.form.js";></script>
> <script>
> function web2py_trap_form(action,target) {
>     jQuery('#'+target+' form').each(function(i){
>         var form=jQuery(this);
>         if(!form.hasClass('no_trap'))
>             if(form.find('.upload').length>0) {
>                 form.ajaxForm({
>                     url: action,
>                     success: function(data, statusText, xhr) {
>                     jQuery('#'+target).html(xhr.responseText);
>                     web2py_trap_form(action,target);
>                     web2py_ajax_init();
>                     }
>                 });
>             } else {
>             form.submit(function(e){
>                 jQuery('.flash').hide().html('');
>                 web2py_ajax_page('post',action,form.serialize(),target);
>                 e.preventDefault();
>             });
>         }
>     });
> }
> </script>
> {{end}}
>
> {{=form}}
>
> {{block extrascript}}
> <script>
> /* hack because jquery.form.js does not properly passes headers */
> jQuery('.flash').hide().html("{{=response.flash}}").slideDown();
> eval("{{=XML(response.js or '')}}");
> </script>
> {{end}}
>
>
>
> On Thu, Apr 25, 2013 at 2:16 PM, Teddy Nyambe <[email protected]>wrote:
>
>> This is not cool, its giving me a weird behaviour and its not even
>> working.
>>
>>
>> On Thu, Apr 25, 2013 at 1:19 PM, Leonel Câmara <[email protected]>wrote:
>>
>>> You need to use some ajax file upload mechanism.
>>>
>>> Here's an example:
>>>
>>> http://www.web2pyslices.com/slice/show/1438/ajax-file-upload-in-loadweb2py-components
>>>
>>> If you follow that example, I recommend you put the javascript directly
>>> on the webpages that will use it so you don't have to deal with versions of
>>> web2py_ajax_page, etc. that are different from the regular web2py ones
>>> elsewhere.
>>>
>>> Quinta-feira, 25 de Abril de 2013 11:23:59 UTC+1, software.ted escreveu:
>>>
>>>> I am having a nightmare getting file upload to work when the form is
>>>> loaded using LOAD or component=(URL, tarrget=div). The file fails to be
>>>> uploaded but the record is added to the DB without the file record. It does
>>>> also not appear in the upload folder
>>>>
>>>>
>>>> --
>>>> ..............................**..............................**
>>>> ...........................
>>>> Teddy Lubasi Nyambe
>>>> Opensource Zambia
>>>> Lusaka, ZAMBIA
>>>>
>>>> Cell: +260 97 7760473
>>>> website: http://www.opensource.org.zm
>>>>
>>>> ~/
>>>> Human Knowledge belongs to the world! - AntiTrust
>>>>
>>>> Man is a tool-using animal. Without tools he is nothing, with tools he
>>>> is all - Thomas Carlyle 1795-1881
>>>>
>>>> /~
>>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>>
>> .......................................................................................
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is
>> all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/ggwmUyp8BEI/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to