Skip to Content
0
Former Member
Nov 04, 2006 at 03:56 AM

IC Web - Set the focus on a field

36 Views

Hi,

I want to set the focus on a field when the view is displayed. So, I have:

<script type="text/javascript"language="JavaScript">
     window.load = setFocus;
     function setFocus()
         {
                 document.getElementById("X1_X3_X12_X13_X14_IDNumber").focus();
       //         document.getElementById("IDNumber").focus();
           }
 </script>

Where the field is

<crmic:inputField id = "IDNumber"
                          width     = "100%"
                          maxlength = "40"
                          value     = "//Customer/IDNUMBER" />

document.getElementById("IDNumber").focus() does not work, but the version with X1_X3_X12_X13_X14_IDNumber does (I looked at the source of the page to find this id of the field).

However, I feel it is not the right thing to do even if it works.

Any ideas on how I can properly use the id of the field to make it work.

Thanks,

Mihai