I would just handle it with a little bit of logic in the main logic
portion of the page...you need to check whether the form has been
submitted anyway to pull the data from the database, so:

<cfif isDefined("form.SomeValue")>
     <database stuff>
     <database stuff>
     <etc>
     <cfset doFocus = True>
<cfelse>
     <cfset doFocus = False>
</cfif>

Then in the html output section of the page, after the form is rendered:

<cfif doFocus>
     <script language = JavaScript>
          document.formname.fieldname.focus();
     </script>
</cfif>

That should work, any stuffups on my part not withstanding, right?

On Thu, 19 Aug 2004 11:43:45 +1000, Barry Beattie
<[EMAIL PROTECTED]> wrote:
> so the page submits and gets reloaded - how do *want* to remember where
> the focus was? remember, it's a new (instance of the...) page that's
> just been loaded
> 
> you could try to track the form field and store it's name in a hidden
> var to send back to the webserver (and come back again, check at the top
> of the page and reset the form "state") - doable but messy
> 
> you could use some javascript to set client cookies (if they ain't
> turned off) - simple but restrictive
> 
> you could change to webservices submitting data via Javascript and
> returning WDDX data to reload the form (again using javascript)
> 
> or you could switch to ASP.NET which "autopostback"s the form
> onChange(), onClick(), etc which stores the page "state" (form focus,
> values, etc) in a special hidden field called "__VIEWSTATE"
> 
> but is there a simple, effective way? not to my knowledge...
> 
> remember, after the submit, you're getting a new version of that
> page...how would you set control focus now?
> 
> good luck
> barry.b
> 
> 
> 
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
>

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to