Grazie per il feedback.
Vorrei sapere in cosa sbaglio.
Ho sostituito 

ajax_page('POST', 
'{{=URL('AllegaNuovoFile')}}',['txtIdCarico','pathCompleto'],'target')

al posto di

ajax('{{=URL('AllegaNuovoFile')}}',['txtIdCarico','pathCompleto'],'target')

e in default.py all'interno di
def AllegaNuovoFile():

ho inserito  semplicemente 

response.flash = "Word done!"
ma non sembra più effettuare alcuna operazione.

In cosa sbaglio?




Il giorno lunedì 7 aprile 2014 18:08:04 UTC+2, Massimo Di Pierro ha scritto:

> Si!
>
> Invece di:
> ajax('{{=URL('AllegaNuovoFile')}}',['txtIdCarico','pathCompleto'],'target')
> usa:
> ajax_page('POST', '{{=URL('AllegaNuovoFile')}}',['txtIdCarico','
> pathCompleto'],'target')
>
> and from:
>
> def AllegaNuovoFile():
>        ...
>        response.flash = "Word done!"
>        # or response.js = "....jquery code to be executed upon return. ... 
> "
>        return dict()
>
> On Monday, 7 April 2014 04:16:47 UTC-5, Carlo DOnofrio wrote:
>>
>> Salve a tutti,
>>
>> vorrei sapere se è possibile avere un feedback di fine esecuzione 
>> istruzioni della funzione richiamata in default.py. 
>>
>> Mi spiego meglio. Ho creato tutta una serie di pagine html in cui, per 
>> esempio, ho necessità di salvare degli allegati in un database creato in 
>> mysql.
>>
>> All'interno della pagina ho queste istruzioni:
>>
>> <table>
>> <tr>
>> <td>
>> <h4> Allega Nuovo File:
>> <td> 
>> <input type="file" name="mioFile" 
>> onchange="this.form.pathCompleto.value=this.value.substr(12);">
>> <input type="text" name="pathCompleto" id="pathCompleto"> 
>> <td>
>>
>> <INPUT type="button" value="Salva"
>> onclick="ControllaNuovoFile(); 
>> ajax('{{=URL('AllegaNuovoFile')}}',['txtIdCarico','pathCompleto'],'target')"/>
>> <td> 
>> </tr>
>>
>>
>>
>> </table>
>>
>>
>> Che richimano la funzione AllegaNuovoFile presente in default.py:
>>
>> def AllegaNuovoFile():
>> directory = "C:\Upload\\"
>> nomefile = request.vars.pathCompleto
>> riferimentoIdCarico= request.vars.txtIdCarico
>> if (nomefile <> '') :
>> filepercorso = directory + nomefile
>> stream = open(filepercorso,'rb')
>> db.tabella_files.insert(nome_file=nomefile,dati_file=db.tabella_files.dati_file.store(stream,filepercorso),
>>  
>> riferimento_id=riferimentoIdCarico,riferimento_tabella="Carico")
>> db.commit()
>> return dict()
>>
>>
>> C' è un modo per avere un feedback da default.py per avere certezza di 
>> esecuzione funzione?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to