views:

369

answers:

2

Hi

I use this call to create modal window using simplemodal (http://www.ericmmartin.com/projects/simplemodal/):

$.get("openform/", function(data){
    $.modal(data, {
     closeHTML:'<a class="modalCloseImg simplemodal-close" title="Close"/>',
     minHeight:400,
     autoResize:'True',
     });
    });

The html output is fairly simple. Among the data is empty div -

<div id="errors"></div>

The problem is that, button in the same form does ajax call and fills #errors with errormessages and the simplemodal wrapper does not autoResize. Even calling

$.modal.resize();

does nothing.

Edit: The call that fills #errors is this:

$("#addk").live("click", function(event){
    $.ajax({
     type: "POST",
     url: "savenow/",
     data: $("#form").serialize(), 
     success: function(msg){
      $("#errors").html(msg);
      $.modal.resize();
     },
     error : function(){
      $("#errors").html(<p>Fail!</p>);
     }
    });
    return false;
});

Using live there because the button too comes from previous ajax call.

Am i doing something wrong? Is there a way to get this working without my own function for resizing the window?

Alan

+1  A: 

first (and this is not the root of your troubles): 'True' and 'true' are strings, as are 'False' and 'false'. All these strings are "truish" in boolean contexts.

second: a quick peek in the source of simplemodal 1.3.3 reveals that autoResize kicks in only when the browser window is resized, which is not your case at all.

just somebody
A: 

try the following error function in the ajax call:


error : function(){
                $("#errors").html("<p>Fail!</p>");
                $(".simplemodal-container").css("height", "auto");
        }
Tommy Knowlton