Two things. First the way you are referencing your form is by name, not ID. So you need to add this: name="LoginForm" to your cfform tag.\
Also, i don't think that form has an onload function. Just put this at the bottom of your code: <script> document.LoginForm.AccessID.focus(); </script> On Fri, Sep 24, 2010 at 8:46 AM, John Pullam <[email protected]>wrote: > > I have a cfform inside an Ajax window and I am trying get the cursor to > appear in the first input field when the window opens. I've tried the usual > javascript solution but nothing seems to work for me. Any ideas? > > Extracted code from the module follows: > > <div id="LoginDiv"> > <cfif LoginMsg> > <p>Please identify yourself, then press "Submit"</p> > <cfelse> > <p class="errormsg">Incorrect Access ID or Password. Please try > again.</p></cfif> > <cfoutput> > <cfform id="LoginForm" onload="document.LoginForm.AccessID.focus();"> > <table id="LoginBox"> > <tr height="21"> > <td width="100"><b>Access ID</b></td> > <td width="100"><cfinput name="AccessID" validate="range" > range="1000,4999" value="#DefAccessID#" size="8" > required="yes" message="A valid Access ID is > required" /></td> > </tr> > <tr height="21"> > <td><b>Password</b></td> > <td><cfinput name="Password" type="password" > value="#DefPassword#" size="8" required="Yes" > message="A password is required" /></td> > </tr> > <tr height="21"> > <td colspan="2"><span class="fineprint">Remember me on this > computer</span> > <cfset checked=IIf(DefRemember EQ > "Yes","'checked'","''")> > <input type="checkbox" name="Remember" value="Yes" > #checked#></td> > </tr> > </table> > <cfinput name="Submit" type="image" value="Submit" > src="../Buttons/MSubmit.png" /> > </cfform></cfoutput></div> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337456 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

