Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Setting initial focus
Last Post 09-16-2008 01:41 PM by Chad Nash. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Jim EvansUser is Offline
going with the flow
going with the flow
Posts:30
Avatar

--
09-14-2008 05:44 AM

    How can I set the focus to a particular textbox when the form is loaded? I assume that it is done with a client-side event but I cannot get it right.

     

    Any help is very appreciated.

     

    Jim

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    09-16-2008 12:13 PM

    Jim,


    Hi. Thanks for your question. I researched this after your post and found a few interesting things (1 bug, 1 work around )



    1. Yes, this is handled using a client side event. This is handled under the 'Initial Javscript Section' and should be formatted as such:



    document.getElementById($(ShortFieldName_FieldID)).focus();



    2. This initial javascript however is also rendered when the form posts back to the page (such as server side validation) so the problem might occur that the form field is set to focused again if you had server side validation. In this case you might use something like this, which would first check to see if the field is empty and then if its empty it would set the focus.



    if ($(ShortFieldName) == '')
    {
    document.getElementById($(ShortFieldName_FieldID)).focus();
    }



    3. The bug I found is that the short field name is not replaced with the actual field ID if the fields 'client side validation' is empty. So you have two work arounds, one is to open up the short field name and save the client side validation with a space in it (it just can't be completely empty ) and the other is to actually get the field ID and use it instead of $(ShortFieldName_Field).



    So... There is a working example of this now at:


    Dynamic Forms Set Field Focus w/ Initial Javascript

     

    Thanks!

     

    -Chad

     

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    09-16-2008 12:21 PM
    Also... This brings up a great enhancement request, we will review adding this same feature as a simple checkbox under module configuration that will 'Set focus to first field on form'. Some browsers might do this automatically but I am not sure.

    -Chad
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    09-16-2008 01:41 PM
    Update Sent Via Email........



    Chad,

    Followed your instructions to a T, including empty space in client-side validation. I deleted all additional modules from the page. I keep getting an error:

    Line: 24
    Char: 4
    Error: 'FirstName' is undefined
    Code: 0
    URL: etc., etc.

    The code that I am using in the module config is:

    if ($(FirstName) == '')
    {
    document.getElementById($(FirstName_FieldID)).focus();
    }
    I tried using the info from the "View Source" that was id= for the field. I then got a different error:
    Error: Expected ';'

    This is the code from View Source:

    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi