Hi, I am able to set focus to a particular textbox onload of a form u

Hi,

I am able to set focus to a particular textbox onload of a form using the below code :
document.getElementById("textControl_fd_component_"+window.FormDesigner.runtimeNamespace+"requestComments").focus();

But this doesn't work for textarea. The page throws an error at run-time. Is it because of "textControl_fd_component"? What do I replace that with?...

OriginalPostID-99124

OriginalPostID-99124

  Discussion posts and replies are publicly visible

Parents
  • Eduardo, this code worked fine for plain forms where there are not much fields. But I faced the following behaviors:

    1) In a form having lots of controls (around 30) - the code didn't bring the focus to the intended textarea.
    2) In a form which is assigned to a group - when a person picks up the task, the following error message is shown in an alert
    "An exception was thrown by the custom event "load" with rule "{var settingfocus = document.getElementsByName(\\"plainTextControl_\\"+\\"requestComments\\");settingfocus[0].focus()}"."
    Could it be because before the person accepts the task (by hitting the Accept button on top of the page), the form is readonly and so the element is not available for focus?

    Any workarounds available?
Reply
  • Eduardo, this code worked fine for plain forms where there are not much fields. But I faced the following behaviors:

    1) In a form having lots of controls (around 30) - the code didn't bring the focus to the intended textarea.
    2) In a form which is assigned to a group - when a person picks up the task, the following error message is shown in an alert
    "An exception was thrown by the custom event "load" with rule "{var settingfocus = document.getElementsByName(\\"plainTextControl_\\"+\\"requestComments\\");settingfocus[0].focus()}"."
    Could it be because before the person accepts the task (by hitting the Accept button on top of the page), the form is readonly and so the element is not available for focus?

    Any workarounds available?
Children
No Data