Hi folks,

I'm in need of some help. I'm using blockUI to display a small set of fields
to the user along with two buttons, "save" and "close". This little
psuedo-form (it's not a true form) appears when the user clicks on a store
from a list of stores that I'm displaying for them. It works great on the
first click (regardless of the store selected) but doesn't work for any
subsequent clicks. All subsequent clicks display the default "Please Wait"
message.

Here's how I'm accomplishing this so far:

The list of stores is in a table. Each row has a click bound to it that
calls a function called SetClickEvent. For different tables this function
performs different actions. In the case of selecting a store, it basically
binds that click to the function EditStore. The EditStore function then
makes an ajax call to my ColdFusion server which builds the psuedo-form and
returns it so that jQuery can then place it in the DOM. The psuedo-form
comes back from the server with all its buttons and all it's fields
pre-filled depending on which store was clicked.

Immediately after putting the markup into the DOM, I use jQuery to find the
buttons and bind their click events to them. Then I call blockUI to show the
psuedo-form.

Like I said, it works like a champ the first time around, but all subsequent
clicks fail. Here's the EditStore function:

function EditStore(id){
    alert(id);
    var $StoreUpdateForm = $("#StoreUpdateForm");
    var $MessageArea = $(".SystemMessages");
    $MessageArea.empty().append("Loading...").show();
    $.AjaxCFC({
        url: "CFC/Display.cfc",
        method: "displayStoreUpdateForm",
        data: {"id":id},
        unnamedargs: false,
        serialization: "json",
        success: function(data) {
            $StoreUpdateForm.empty().append(data);
            $("#CloseBtnID").bind("click",function(){
                $.unblockUI();
            });
            $("#SaveBtnID").bind("click",function(){
                alert("coming soon");
            });
            $.blockUI($StoreUpdateForm[0],{padding:'2px',
borderColor:'#3F6F5E', top:'25%', left:'50%' });

        },
        complete: function(){
            $MessageArea.empty().hide();
        }
    });
}

Unlike, most of my projects this one can be viewed online, but I'd have to
give my password to the development area of this little app., and (I know
this is a bad thing, but...) even in the development version it deals with
live data. I'm hesitant to just post that information to a list. It's not
that the app allows access to overly sensitive data, but I'd rather be safe.

Let me know if you just have to, have to, have to see the bug in the wild.

I am using the latest version of blockUI, with the latest version of jQuery.
I have verified (via the alert statement that you can see at the top of the
EditStore function) that each time a store gets clicked on, it's ID is
indeed passed into the function as expected. Presumably the problem exists
somewhere in the success block of my ajax call.

Cheers,
Chris

-- 
http://cjordan.us

Reply via email to