Klaus,

Thanks for responding. This is happening in both IE and FF. I hadn't
thought of ThickBox having an onShow Callback. That may be my best
bet. I thought that putting code in the $(function(){}); section was
supposed to prevent this sort of thing.

For what it's worth, here's my code for the dialog page that gets
loaded into the thickbox:

<cfsetting showdebugoutput="false">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
        <head>
                <title>Cottonwood Financial Title Loans</title>
                <style type="text/css">@import url("CSS/Main.css");</style>
                <style type="text/css">@import url("CSS/thickbox.css");</style>
                <!--[if IE]>
                        <style type="text/css">@import 
url("CSS/Main.ie.css");</style>
                <![endif]-->
                <cfscript>
                        ShowLog4JS = false;
                        JSIncludeList = "";
                        JSIncludeList = ListAppend(JSIncludeList, 
"jquery.dump");
                        JSIncludeList = ListAppend(JSIncludeList, 
"jquery.block");
                        JSIncludeList = ListAppend(JSIncludeList, 
"jquery.json");
                        JSIncludeList = ListAppend(JSIncludeList, 
"jquery.cfjs");
                        JSIncludeList = ListAppend(JSIncludeList, 
"jquery.thickbox");
                        JSIncludeList = ListAppend(JSIncludeList, 
"jquery.dimensions");
                        JSIncludeList = ListAppend(JSIncludeList, "json");
                        if(ShowLog4JS){
                                JSIncludeList = ListAppend(JSIncludeList, 
"log4j");
                        }
                </cfscript>
                <script type="text/javascript" 
src="Include/js/jquery.js"></script>
                <script type="text/javascript" 
src="Include/js/wddx.js"></script>
                <script type="text/javascript" 
src="Include/js/jquery.AjaxCFC.js"></
script>
                <CFOutput><script type="text/javascript">
$.AjaxCFC({require:'#JSIncludeList#'});</script></CFOutput>

                <script>
                        $(function(){
                                var v;
                                var $this;
                                var $SSN = $("#SSNID");
                                var charCode;
                                var keyList = 
"8,36,37,39,46,48,49,50,51,52,53,54,55,56,57";
                                $SSN[0].focus();
                                $SSN.bind("keypress",function(e){
                                        $this = $(this);
                                        v = $this.val();
                                        charCode = (e.which) ? e.which : 
e.keyCode;
                                        //alert(charCode);
                                        if(!$.ListFind(keyList,charCode)){
                                                alert(charCode);
                                                return false;
                                        }
                                        else if($.Len(v) > 10 && 
!$.ListFind(keyList,charCode)){
                                                return false;
                                        }
                                        else{
                                                //alert($.Len(v));
                                                if(($.Len(v) == 3 || $.Len(v) 
== 6) && charCode != 8){
                                                        $this.val(v + "-");
                                                }
                                        }
                                });
                        });
                        var CloseButtonImage = "<img 
src=\"images/closebtn.gif\" style=
\"margin:0px; padding:0px; border:0px;\">";
                        function doSearch(){
                                var ssn = $("#SSNID").val();
                                var _ssn = ssn.replace(/[\(\)\- ]/g, "");
                                var elmLastName, elmFirstName, 
elmCustomerNumber;
                                if(_ssn.length === 9 && $.IsNumeric(_ssn)){
                                        _ssn = $.Insert("-", _ssn, 3);
                                        _ssn = $.Insert("-", _ssn, 6);
                                        $.AjaxCFC({
                                                url: "CFC/Customer.cfc",
                                                method: "new",
                                                data: {"SSN":_ssn},
                                                unnamedargs: false,
                                                serialization: "json",
                                                success: function(data) {
                                                        //$.dump(data);
                                                        if(!data.FOUNDONE){
                                                                //alert("Sorry, 
I was unable to locate a customer with that
Social Security Number.\nCheck the number and try again. If you're
sure it's correct, then make sure\nthe customer is in CashWise and try
again.");
                                                                alert("Customer 
not found.  Please fill out name and customer
number for this applicant.");
                                                                
parent.LastName.readOnly = false;
                                                                
parent.FirstName.readOnly = false;
                                                                
parent.CustomerNumber.readOnly = false;
                                                                
parent.SSN.value = data.SSN;
                                                        }
                                                        else{
                                                                
parent.LastName.value = data.LASTNAME;
                                                                
parent.FirstName.value = data.FIRSTNAME;
                                                                
parent.CustomerNumber.value = data.CUSTOMERNUMBER;
                                                                
parent.SSN.value = data.SSN;
                                                        }
                                                        parent.TB_remove();
                                                },
                                                error: function(){
                                                        alert("Error");
                                                }
                                        });
                                }
                                else{
                                        alert("Invalid SSN.");
                                }
                        }

                </script>
        </head>
        <CFOutput>
        <body style="margin:0px; border: 0px dashed; width:99%; height:98%;">
                <div id="MainContent" style="width:300px; padding-top:7px; 
border:
0px dashed;">
                        <form name="f" onsubmit="doSearch();return false;"
style="display:inline;">
                        <table border=0 cellspacing=3 cellpadding=0 
style="width:100%;
border-collapse: collapse;">
                                <tr>
                                        <td style="text-align:left; 
width:90px;">Customer SSN</td>
                                        <td style="text-align:left;"><input 
type="text" name="SSN"
id="SSNID" value="" onload="this.focus();"></td>
                                </tr>
                        </table>
                        <div id="buttonRow" style="padding-top:10px; border:0px 
dashed
green; text-align:right;">
                                <input type="submit" value="Search">
                        </div>
                        </form>
                </div>
        </body>
        <script>
                //$("##SSNID")[0].focus();
        </script>
        </CFOutput>
</html>


I'll try the onShow callback, but if you can think of anything else,
I'd love to hear about it.

Many thanks,
Chris

On Jul 5, 11:45 am, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> Chris Jordan wrote:
> > Bump.
>
> > Can anyone shed some light on this?
>
> > Thanks heaps,
> > Chris
>
> > On Jul 4, 3:42 pm, Christopher Jordan <[EMAIL PROTECTED]>
> > wrote:
> >> Okay, just an update for anyone thinking of helping. I ran the dialog
> >> page by itself (sans thickbox) and the focus gets set just fine. So this
> >> is somehow related to thickbox.
>
> >> I would greatly appreciate any help.
>
> >> Cheers,
> >> Chris
>
> Chris, which browser did that error occur in? I had a similiar one in IE
> when trying to focus (accidently) a form control that was hidden (in
> another tab for example). I filtered hidden ones and that worked out.
>
> So maybe you're trying to access that element just a little too early.
> Try a little timeout or maybe Thickbox also has an onShow callback
> (Thickbox Reloaded has ;-)).
>
> Another thing to look for (I also ran into this): Make sure your
> selector to fetch the input to get focus accidently matches an hidden
> input...
>
> --Klaus

Reply via email to