I think the scope issue is coming from the dynamic caracteristic of your
modal that you add to the DOM with the web2py_component() function...

The second comment on the question here should work :
http://stackoverflow.com/questions/10280569/jquery-select-dynamically-created-html-element

But you should not remove the parent empty div that you need to add to the
component shell view, you need to remove the child that should be the
modal... Not sure if in this select scenario it gonna be better or not
though...

I you were have some way to use .on() some how it could solve the problem
if the problem come from the fact that your modal is a dynamic DOM
element...

You can try by adding a button that you can click like in the SO question
if you can hide/remove the modal this way or not.

You could also just redirect on the shell view and use valuekeep depending
of how you use your modal for subform... I guess your need is for adding a
missing value in a lookup table and autoselect it in the form you try to
complete if so, the blog post in one of my previous mail do exactly that
and it works I test it (the modal form at least work ok). But I am not sure
it autoselect the inserted value, but this is easy to do with a trigger
once component form has pass.

Hope it helps

Richard



On Wed, May 28, 2014 at 2:25 AM, weheh <richard_gor...@verizon.net> wrote:

> Alright, I got it to work, but it's super fugly. I created a javascript
> function:
>
> function hide_modal() {
>
>     $("#contact-dialog").modal("hide");
> }
>
>
> and then in my controller I replaced the response.js with this:
>
> response.js = 'hide_modal("#contact-dialog");'
>
> So that works. But WHY? I think there's something very fish with the
> scoping inside of the response.js. Can anyone explain what's going on here?
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to