You're not passing a function reference, you are executing an inline
function. Execution will happen the moment the parameters passed into
the greybox function are evaluated. It's like passing 1+2 as a
function parameter - the 1+2 will first be evaluated and the result of
this evaluation (3) will be passed to the function. Similarly, you
alert command is being evaluated (you get the alert message), and then
the *result* of that evaluation is passed to the greybox function.
You need to pass a reference to the function, not execute it inline.
Try this:
function testing() { alert("WHEEE!"); }
........
GB_showCenter('Some Title', this.href, 420, 420, testing)
--
Tyler Style
http://malthusian-solutions.com
http://nirdvana.com
MarkofCain wrote:
> I am using GreyBox to open a form page. The form page then submits
> the data to a database. After the form has been processed, an
> acknowledgment that says "Thank you" is fed into the GreyBox where the
> form used to be located. Upon close of the GreyBox window, I want to
> refresh a div on the calling page. I am attempting to refresh the
> page via the callback fn parameter in GB_showCenter.
>
> My callback function works sorta -- but it fires IMMEDIATELY BEFORE
> the GreyBox appears rather than at the close of the GreyBox.
>
> In order to debug this, I am using a call to a function that fires an
> alert box.
>
> Here is the code that is used to start the process:
>
> <a href="http://www.somedomain.com/some_form.html?some_parameter=1"
> onclick="return GB_showCenter('Some Title', this.href, 420, 420,
> alert_me('alert_me 1'))">Click Here to see the Form</A>
>
> Here is the sequence I am expecting when the link gets clicked:
> 1) GreyBox opens
> 2) Data is entered and submitted
> 3) Data is processed and thank you displayed
> 4) user closes the window
> 5) the function "alert_me" is called
>
> Here is what I am experiencing in IE6 and FF2 (only browsers tested to
> date):
> 1) the function "alert_me" is called
> 2) GreyBox opens
> 3) Data is entered and submitted
> 4) Data is processed and thank you displayed
> 5) user closes the window
>
> Why is the callback fired immediately? Any suggestions you could give
> me would be great!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GreyBox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/greybox?hl=en
-~----------~----~----~----~------~----~------~--~---