Seems to be little overkill with all that code in the view! lol. Anyway,
here is the app that demonstrate the conflict.
Model:
db.define_table('mytable',
Field('name', type='list:string', requires=IS_IN_SET
(('True','False', 'Neither'), multiple=True)))
*View (default/main_page.html):*
{{extend 'layout.html'}}
<h1>
{{=BUTTON( 'Apply',_type="button",_class = "btn btn-default",_onclick="""
$('#cont_id').modal('show') """)}}
Apply to see the modal
</h1>
{{=main_pg}}
<script>
jQuery(document).ready(function() {
var uploader = new qq.FileUploader({
// pass the dom node (ex. jQuery(selector)[0] for jQuery users)
element: document.getElementById('project-file-uploader'),
// path to server-side upload script
action: '{{=URL("upload_callback")}}/{{=request.args(0)}}',
sizeLimit: 150000000,
minSizeLimit: 0,
allowedExtensions: ['xls','jpg', 'jpeg', 'pdf',
'txt','doc','htm','html','xml','xmls', 'txt','ppt','png', 'gif'],
// set to true to output server response to console
debug: true,
// events
// you can return false to abort submit
onSubmit: function(id, fileName){},
onProgress: function(id, fileName, loaded, total){},
onComplete: function(id, fileName, responseJSON){},
onCancel: function(id, fileName){},
messages: {
// error messages, see qq.FileUploaderBasic for content
typeError: "{file} {{=T('has invalid extension.')}}
{{=T('Only')}} {extensions} {{=T('are allowed.')}}",
sizeError: "{file} {{=T('is too large, maximum file size is')}}
{sizeLimit}.",
minSizeError: "{file} {{=T('is too small, minimum file size
is')}} {minSizeLimit}.",
emptyError: "{file} {{=T('is empty, please select files again
without it.')}}",
onLeave: "{{=T('The files are being uploaded, if you leave now
the upload will be cancelled.')}}"
},
showMessage: function(message){ alert(message); }
});
});
</script>
*Controller*:
def modal_content():
form = SQLFORM(db.mytable) # or even form = SQLFORM.grid(...)
return dict(form=form)
def main_page():
main_pg=DIV('')
#show_modal_btn = BUTTON( 'Show modal',_type="button",_class = "btn
btn-default",_onclick=""" $('#cont_id').modal('show') """)
form = LOAD(f='modal_content.load', ajax=True, ajax_trap=True )
dialog = modal_wrapper(form, _id='cont_id', header='Header',
footer='footer')
#don't forget to add dialog and show_modal_btn to main page
#main_pg.append(show_modal_btn) # or main_pg.append(
DIV(show_modal_btn) ) or something else
main_pg.append(dialog)
#main_pg.append(show_modal_btn)
return dict(main_pg = main_pg)
def modal_wrapper(content, _id, header='', footer=''):
main_wrap = DIV('', _class="modal fade", _role="dialog", _id=_id,
_tabindex="-1" )
title_id = _id + '_title'
main_wrap['_aria-labelledby']=title_id
dialog_div=DIV('', _class="modal-dialog" , _role="document")
content_div=DIV('', _class="modal-content")
header_div = DIV( _class="modal-header")
close_cross = BUTTON(
SPAN(XML('×'), **{'_aria-hidden':"true"}),
_type="button", _class="close",
data={'dismiss':"modal"},
**{'_aria-label':"Close"}
)
title_h4 = H4( header, _class="modal-title", _id = title_id)
body_div = DIV( content, _class="modal-body")
close_btn = BUTTON('Close', _type="button", _class="btn btn-default",
data={'dismiss':"modal"})
footer_div = DIV( footer, close_btn, _class="modal-footer")
# gluon all
main_wrap[0] = dialog_div
dialog_div[0] = content_div
header_div.append(close_cross)
header_div.append(title_h4)
[content_div.append(c) for c in (header_div, body_div, footer_div)]
return main_wrap
On Wednesday, February 24, 2016 at 10:07:45 PM UTC-5, Richard wrote:
>
> As the slice says : Quick and Dirty...
>
> I would stay away of that...
>
> You may also consider js lib for that...
>
> Why not : http://fineuploader.com/purchase_form.html
>
> If your app is open source and doesn't make money.
>
> Richard
>
> On Wed, Feb 24, 2016 at 10:02 PM, Richard Vézina <[email protected]
> <javascript:>> wrote:
>
>> Here a repo of a presumably functional implementation of the recipe link
>> above : https://bitbucket.org/xavrenard/multiupload_module/src
>>
>> It was mention at the end of the post completly.
>>
>> Good luck
>>
>> Richard
>>
>> On Wed, Feb 24, 2016 at 7:47 PM, Ron Chatterjee <[email protected]
>> <javascript:>> wrote:
>>
>>> In other words, this code that I leveraged from:
>>>
>>> http://www.web2pyslices.com/slice/show/
>>> 1428/quick-and-dirty-multi-file-ajax-file-upload
>>>
>>> Should be updated using the links you send me because if seems there
>>> are others who also experienced the same issues. Let me post the code. And
>>> I agree, it will probably be better not to upload .w2p as most people will
>>> cut and paste.
>>>
>>>
>>> On Wednesday, February 24, 2016 at 5:01:02 PM UTC-5, Richard wrote:
>>>>
>>>> This thread seems to talk about how to do it :
>>>> https://groups.google.com/forum/#!msg/web2py/OysSkb6c-zI/Lz26h9uZog0J
>>>>
>>>> Here there is a recipe :
>>>> http://in10min.blogspot.ca/2013/04/web2py-implement-multiple-files-upload.html
>>>>
>>>> Richard
>>>>
>>>> On Wed, Feb 24, 2016 at 4:58 PM, Richard Vézina <[email protected]>
>>>> wrote:
>>>>
>>>>> Ok, I was just talking about the name of your app...
>>>>>
>>>>> I think you will have more help if you append some relevant code to
>>>>> the issue to this thread...
>>>>>
>>>>> Installing an app from someone else is generally the lasting I do when
>>>>> I can't help the person by simple code review...
>>>>>
>>>>> Is this something you write from your own? From a web2py slice?
>>>>>
>>>>> You want multiple upload feature, rigth?
>>>>>
>>>>> Regards
>>>>>
>>>>> Richard
>>>>>
>>>>> On Wed, Feb 24, 2016 at 4:18 PM, Ron Chatterjee <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Seems strange. The issue is. If I delete that JQuery (everything
>>>>>> inside the script), the modal works fine (just click main_page in the
>>>>>> controller and then the button subsequently). The moment I insert the
>>>>>> multi
>>>>>> file upload (from the link in the slide) and for which I need the
>>>>>> jQuery,
>>>>>> the model doesn't work. It gets hang. It seems conflict with CSS may be
>>>>>> I
>>>>>> am not sure what the issue is.
>>>>>>
>>>>>> On Wednesday, February 24, 2016 at 3:18:37 PM UTC-5, Richard wrote:
>>>>>>>
>>>>>>> What the issue exactly? Your app name seems to refer to multiple
>>>>>>> LOAD() issue, but you are talking about jQuery issue...
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>> On Wed, Feb 24, 2016 at 10:33 AM, Ron Chatterjee <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Guys, I have an app where I use the model and it works fine. The
>>>>>>>> moment I have the Jquery upload script in the view it seems to break
>>>>>>>> and
>>>>>>>> cause a conflict. Any help or suggestion that experts can provide?
>>>>>>>> Attached
>>>>>>>> is the app. Controller is main_page
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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.
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>> 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.
>>>>>>
>>>>>
>>>>>
>>>> --
>>> 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] <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>
--
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.