on 05-15-2009 1:57 PM
Hi,
I want to set focus on input field on first load of the form.
I use next code
IWDAttributeInfo attribute = wdContext.nodeSearchInput().getNodeInfo().getAttribute(IPrivateSearchSDCompView.ISearchInputElement.SEARCH_INPUT);
wdThis.wdGetAPI().requestFocus(wdContext.currentSearchInputElement(), attribute);
which put in wdDoModifyView .
The code doesn't work when page is load for first time.
Input field is in ViewContainerUIElement which is in Tab.
May be I have to put focus first on container ? (don't know how)
Can any one suggest me how to fix this problem.
Best Regards,
Dimitar
Hi Velinov,
Put the above mentioned code in the WdDoInit() method of view where the inputfield is there.
Thanks
Susmita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Dimitar,
try the following code
if(firstTime)
{
IWDInputField InputField = (IWDInputField) view.getElement("INPUT_1");
InputField.requestFocus();
}
where INPUT_1 is the ID of the input field to which you want to set the focus.
Hope it will solve your problem.
Regards,
Sarbjeet Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dimitar Velinov,
If you want to set focus on the first load of UI then you must use the wdDoInit() method because wdDoModify() doesn't execute at first time it get executed whenever any modification in UI happens.
Second you should not use wdDoModify() without any suitable condition as you have done in your code snippet. if you want to set the focus more then one time or again and again then better create one method and call it. It will put an impact on performance and maintainability.
Regards
Jeetendra
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.