cancel
Showing results for 
Search instead for 
Did you mean: 

how to set focus to the input field on form load in jspDynpage

Former Member
0 Kudos

Hi can anybody suggest me how to set focus to the input field on loading the jspDyn Page?

Regards,

Joseph

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Joseph,

focusedControl can be used.

Check with this link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/1d/2cff40e39ba854e10000000a1550b0/frameset.htm

Eg:

<hbj:inputField

id="myInputField1"

type="String"

invalid="false"

width="310"

value="After editing press <Enter> to submit"

visible="true"

disabled="false"

required="true"

maxlength="30"

size="50">

<%

myFormId.setFocusedControl(InputField inp_field)

%>

</hbj:inputField>

Regards

Harini S

Former Member
0 Kudos

Hi Harini,

I used like that ...but it is giving me error.

<hbj:inputField

id="InputSearch"

maxlength="<%=FFOrders.getMaxLength()%>"

type="string">

<%

myFormId.setFocusedControl(InputField Inp_Search);

%>

</hbj:inputField>

ERROR:

Caused by: com.sapportals.portal.prt.servlets_jsp.server.compiler.CompilingException: /usr/sap/POD/JC30/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/web-inf/portal/portalapps/ffservices_forjsp/work/pagelet/_sapportalsjsp_fforders.java:377: ')' expected

myFormId.setFocusedControl(InputField InputSearch);

^

1 error

It seems there is not taglib for focusedcontrol.

Is there any other alternate way?

Regards,

Joseph

Former Member
0 Kudos

Hi,

The statement

<i><%

myFormId.setFocusedControl(InputField Inp_Search);

%></i>

is correct. It uses classlib,and not taglib.

Can u post the error log? The error may be in <b>maxlength</b>. Just hardcode the maxlength and check if your code works.

Regrads,

M.Subathra

Former Member
0 Kudos

Hi Joseph,

The myFomId is the id provided in <form id="myFormId">

Below is the correct code(dont mention "InputField" in parameters of setFocusedControl method )

<hbj:inputField

id="InputSearch"

maxlength="<%=FFOrders.getMaxLength()%>"

type="string">

<%

myFormId.setFocusedControl(InputSearch);

%>

</hbj:inputField>

Hope this will help.

Thanks and regards,

Amol

Former Member
0 Kudos

Hi Joseph,

The error is this.

It is not

myFormId.setFocusedControl(InputField InputSearch);

It should be

myFormId.setFocusedControl(InputSearch);

The classlib itself should work fine.

InputField InputSearch is given in the syntax to just let us know that InputSearch is the id of the inputfield.

Regards

Harini S

Saravanan_SD
Advisor
Advisor
0 Kudos

Hi Joseph,

Check this thread. An alternate solution.

<a href="http://">https://www.sdn.sap.com/irj/sdn/thread?threadID=94061</a>

Regards,

Saravanan

Former Member
0 Kudos

Hi Harini,

Thanks a lot for your valuable suggestion.

It is working fine now.

But I'm sorry I have already given full points to Amol and now i'm giving you 6 points.

Thanks and Regards,

Joseph

Former Member
0 Kudos

Hi Amol,

Thanks a lot for your valuable suggestion.

It is working fine now.

Regards,

Joseph

Former Member
0 Kudos

Hi,

I'm searching since a long time for a real <b>setFocus()

</b>

But if I use this setFocusedControl, the Inputfield gets only a very stupid useless frame but cursor is not set into that field.

Is this working in your application?

Regards,

Dennis

Former Member
0 Kudos

Hi Dennis,

I got just focus into the input field but there is no cursor blinking in that field.This suffice my criteria.

Regards,

Joseph

Answers (0)