cancel
Showing results for 
Search instead for 
Did you mean: 

set focus on a bsp component

Former Member
0 Kudos

Hi

i need to set focus on a component that will be returned by a bsp call

<bsp:call comp_id="<%= CL_HRPIQ00BSPFRAME=>C_MESSAGE_CONTROLLER %>" />

Any help in this regard will be very helpful.

thanks

aditya

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Please pardon the interruption. I don't mean to break up the flow of the discussion in this thread. However I want to throw out there the possibility of using the <phtmlb:focusRect> element instead of custom javascript to set the focus. It sounds as though it will serve the purpose.

The coding inside the element is really simple. However it works through the Unified Rendering Framework, so it might play better with other BSP Extension Elements.

I should note that like most of hte phtmlb elements this only works in Design 2003.

Former Member
0 Kudos

Hi Thomas,

could you explain the use of <phtmlb:focusRect> a little bit in detail since i am not able to find its documentation or usage anywhere.

thanks

aditya

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It is fairly simple. It only has one attribute - focusElementId. This is where you supply the id of the item that you want to have receive the focus.

Former Member
0 Kudos

Hi Thomas,

thanks for focusrect tag it really solved my problem.

thanks again to all who contributed.

Aditya

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

I have a table view , When i select a row in the table view , focus must be set on the first column, the first column is a editable column .

I have used <phtmlb:focusRect>

the attribute for the focusElementId is the cell id of the particular cell where focus is to be set..

but the focus is not set ...

when I give the id of the table view .. it gets focus on the table view ..

for eg., table view id = 'itmlst' when i pass this as attriute it gets focus on the table view ..

when i try to get focus on a particular cell .. id 'itmlst_1_1' .. it doesnt get focus on that cell ..

Please give me ur suggestions for setting the focus on a particular cell when selecting a row

Former Member
0 Kudos

Hi Aditya / Thomas ,

I too have a similar problem , to set focus on a bsp component.

My requirement is to set focus on a particular cell in a table view . I tried giging the id of the cell .. but it did not work..

If i pass the id of the table view .. the focus is set ..

how do i set focus on a particular cell in a table view ?

Please help ..

Former Member
0 Kudos

Hi Sivraj,

Sabestian had posted the soultion for this problem earlier in this thread.here it is:

for setting the focus on the tableview:

<script for="bspframe_msg_tab" event=onload type="text/javascript">

this.focus();

</script>

for setting the focus on a special field in the tableview:

<script for="bspframe_msg_tab[row]-columname" event=onload type="text/javascript">

this.focus();

</script>

I think this would work.But if you don't want to use javascript then to focusrect pass the id of tableview coulmn to which you want to put focus on.

thanks

aditya

Former Member
0 Kudos

Hi,

to know a bit more - please post the coding of the view which is called.

Regards

Former Member
0 Kudos

hi

the view is bit comlex but basic funda is to show messages,using a "tableview", here is code for that:

<%

ELSE. " full mode: show all the messages

%>

<htmlb:gridLayout columnSize = "1"

rowSize = "1"

width = "100%" >

<htmlb:gridLayoutCell columnIndex = "1"

rowIndex = "1"

horizontalAlignment = "RIGHT" >

<htmlb:link id = "close_list"

text = "<%= otr(PMIQ/LIST_CLOSE) %> "

onClick = "onMessageCollapse" />

</htmlb:gridLayoutCell>

</htmlb:gridLayout>

<htmlb:tableView id = "bspframe_msg_tab"

table = "<%= t_messages %>"

visibleRowCount = "5"

headerVisible = "1"

headerText = "<%= otr(PMIQ/MESSAGES) %>"

width = "100%"

selectionMode = "NONE"

design = "STANDARD" >

<htmlb:tableViewColumn columnName = "ICON_PATH"

horizontalAlignment = "center"

type = "image"

linkColumnKey = "ICON_PATH"

tooltipColumnKey = "ICON_TOOLTIP"

width = "5%"

title = "<%= otr(SOTR_VOCABULARY_BASIC/type) %>" />

<htmlb:tableViewColumn columnName = "TEXT"

horizontalAlignment = "center"

title = "<%= otr(PMIQ/MESSAGES) %>" />

</htmlb:tableView>

thanks

aditya

Former Member
0 Kudos

for setting the focus on the tableview:

<script for="close_list" event=onload type="text/javascript">

this.focus();

</script>

for setting the focus on the tableview:

<script for="bspframe_msg_tab" event=onload type="text/javascript">

this.focus();

</script>

for setting the focus on a special field in the tableview:

<script for="bspframe_msg_tab[row]-columname" event=onload type="text/javascript">

this.focus();

</script>

I think you get the algorithm - put the script directly after the htmlb element.

Regards

Former Member
0 Kudos

Hi Sebastian,

thanks for answer but is there any other approach,

i have to put focus on message due to some "accessibility" issue and i don't think using javascript would be a correct approach since if user disables his javascript then its going to raise accessibility issue again.

thanks

aditya

Former Member
0 Kudos

Hi Sabestian,

i tried setting focus on an entire GridLayoutCell consisting of an image then a textview and agin a textview.

<htmlb:gridLayoutCell id = "row1"

columnIndex = "1"

rowIndex = "1"

horizontalAlignment = "LEFT"

verticalAlignment = "middle" >

<htmlb:image id = "icon1"

src = "<%= v_icon_signal %>"

tooltip = "<%= v_icon_tooltip %>" />

<htmlb:textView text="<%= v_title_text %" />

</htmlb:gridLayoutCell>

<script for="input1" event=onload type="text/javascript">

this.focus();

</script>

but this is not working.What may be the problem?

What i can comprehend is since this view is just being included in another view so this script will not run as this view is not loaded but included so there is no "onload" event.Please correct me if i am wrong.

thanks

aditya

Former Member
0 Kudos

Hi Aditya,

You wrote:

<script for="<b>input1</b>" event=onload type="text/javascript">

this.focus();

</script>

But the for attribute of the script should have a value which should be id of some htmlb element.

I cannot see any htmlb element with id value as input1.

Hope it helps you.

Regards,

Maheswaran.B

Former Member
0 Kudos

Hi Aditya,

at first javascript: the bsp framework renders a lot of javascript - so it shouldn't be disabled, if the framework is used.

For the "for=" attritbute you have use the id the focus is to be set. In your case:

<script for="row1" event=onload type="text/javascript">

this.focus();

</script>

The onload-event is processed for every element when it is loaded into browser client. The call of the controller on server side is another thing - this simply organizes to render the html-string, which is submitted to the client. Don't mix it up! If you want to learn more what is rendered you can have a look at source html on client-side by your browsers context menu.

Regards,

Sebastian

Former Member
0 Kudos

Sorry got that wrong but even with row1 its not working.

thanks

aditya

Former Member
0 Kudos

Sometimes the focus has a parent element - the following could help:

Try

<script for="row1" event=onload type="text/javascript">

document.all.focus=false;

this.focus();

alert('Focus was processed');

</script>

Former Member
0 Kudos

Hi Sabestian,

i tried even this code but its not working.

I am amused how come alert didn't came up that means control is not going to that line but i inserted an input box just before that and it appeared,that means there is some problem with javascript.

by the way in my application all java script functions are wriitem under a particular page Fragment i copied this code in that file also but without success.

Do you have any idea what could be the problem?

thanks

aditya

Former Member
0 Kudos

Hi again,

i would suppose that the onload-event is not supported for the rendered html-element. What about setting the focus on the image - this should work like it works for the input.

Regards