Hello,

I'm trying to get a custom js confirmation popup working. This is pretty 
much verbatim from the 2nd answer at - 
https://stackoverflow.com/questions/887029/how-to-implement-confirmation-dialog-in-jquery-ui-dialog

When I add this code below to the view, this kills the rest of the js on 
the page, e.g. no dropdown menus work anymore, anywhere. The firefox 
console prints the 'TypeError: $(...).dialog is not a function' error at 
the start of the '$("#dialog").dialog({' line (see the view below). I can't 
figure out this error; some places say it's due to conflicting js/jq 
libraries loaded but I don't think that's the case here since I have a 
pretty standard web2py install.

Here's the portions of my view-



<script>
jQuery(document).ready(function() {

    $("#dialog").dialog({
        modal: true,
        bgiframe: true,
        width: 500,
        height: 200,
        autoOpen: false
    });

    $(".lb").click(function(e) {

        e.preventDefault();
        var theHREF = $(this).attr("href");

        $("#dialog").dialog('option', 'buttons', {
            "Confirm" : function() {
                window.location.href = theHREF;
            },
            "Cancel" : function() {
                $(this).dialog("close");
            }
        });

        $("#dialog").dialog("open");

    });

});

</script>


<div id='maindiv'>
        <table>
            <thead>
            </thead>

            <tbody>
                    <tr>
                        <td> 
                            <ul class="nav">
                                <li class="dropdown">
                                    <a href="#" 
onclick="javascript:void(0);return false;">Action</a>
                                    <ul class="dropdown-menu">
                                        <li class="lb">{{=A('Delete', 
_href=URL('startup', 'delete_record', args=['maindb', 6]))}}</li>
                                </li>
                            </ul>
                        </td>
                    </tr>
            </tbody>
        </table>
</div>

-- 
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