cancel
Showing results for 
Search instead for 
Did you mean: 

How to change a button attributes dynamically?

former_member182426
Active Contributor
0 Kudos

hi friends,

I have to change attributes of a button dynamically when another button clicked.

In my BSP there are 2 buttons.

1. CHANGE

2. UPDATE

i have to change only DISABLED attribute of these two.

Now when i clicked on CHANGE automatically UPDATE BUTTON has to be ENABLED and CHANGE BUTTON has to be DISABLED.

How can i change attributes in event handler.

Thanks & Regards,

Shankar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this.... On input processing

DATA: event type REF TO cl_htmlb_event,
      button type  ref TO cl_htmlb_button.
event ?= cl_htmlb_manager=>get_event( runtime->server->request ).
 clear: status.
  if event is not INITIAL.
   case event->id.
    when 'btn_up'.
      status = 'false'.
       status1 = 'true'.
      when 'btn_ch'.
         status = 'true'.
        status1 = 'false'.
        endcase.
        endif.
On create
status = 'false'.
status1 = 'false'.

former_member182426
Active Contributor
0 Kudos

hi,

Thanks for ur reply. But here wat's status and status1.

these wat type of attributes and where to assign it. it means string or char.

And Event OnInput Processing

DATA button_event TYPE REF TO cl_htmlb_event_button .

DATA: event TYPE REF TO if_htmlb_data.

IF event IS NOT INITIAL AND event->event_name = htmlb_events=>button .

button_event ?= event .

CASE event->event_server_name.

WHEN 'BTN_CHNG'.

disp_upd = 'true' .

disp_chng = 'false' .

WHEN 'BTN_UPD'.

disp_upd = 'false'.

disp_chng = 'true'.

endcase.

endif.

And Event OnInitialization

disp_chng = 'false'.

disp_upd = 'true'.

Now no errors in this. but It's not working. Any modification is there to do.

And one more thing i saw in this posts, wat ever you people are posted the queries that and all appearing in a box(Code lines), how it is possible.

Thanks & Regards,

Shankar.

Answers (1)

Answers (1)

former_member184111
Active Contributor
0 Kudos

Hi,

Layout:

<htmlb:button id      = "change"
                              text    = "change"
                              on C l i c k  = "change" 
			      disabled = <%= dis_chng %>	 />

<htmlb:button id      = "update"
                              text    = "update"
                              
			      disabled = <%= dis_upd %>	 />

in eventhandler onInputProcessing:


DATA     
      button_event      TYPE REF TO cl_htmlb_event_button ,
      .

DATA:       event             TYPE REF TO if_htmlb_data.


IF event IS NOT INITIAL AND event->event_name = htmlb_events=>button .
  button_event ?= event .
  CASE event->event_server_name.

    WHEN 'change'.
		dis_up = false .
                dis_chng = true .
endcase.
endif.

disp_up and disp_chng are page attributes of type string and the page is statefull.

Regards,

Anubhav.

former_member182426
Active Contributor
0 Kudos

HI JAIN,

thanks for your solution.

But i am getting error like this.

"You must assing a value to the property"

And one more thing is when it shows first time it means initialation of page the attributes must be like this.

update should be enabled and change should be disabled.

Thanks & Regards

Shankar.

former_member184111
Active Contributor
0 Kudos

Hi,

But i am getting error like this.

"You must assing a value to the property"

Please check the page button.htm of application SBSPEXT_HTMLB for sample code .

And one more thing is when it shows first time it means initialation of page the attributes must be like this.
update should be enabled and change should be disabled.

OnCreate :

dis_chng = 'false' .

dis_upd = 'true' .

Former Member
0 Kudos

Hi

U have to set the disable property with in double quote

On latyout

disabled ="<%=status%>"

Former Member
0 Kudos

In page attributes

status type string
status1 type string

Regards,

Sri

former_member182426
Active Contributor
0 Kudos

hI VIDYA,

thanks alot, my problem solved.

And one more thing wat ever you send the code it's displaying in a box. how it's coming. but for me it's not coming. Wat it's...

Thanks & Regards,

Shankar.

former_member182426
Active Contributor
0 Kudos

hi vidya,

Did you tried displaying a payslip in BSP page in PDF format.

I have one requirement like that.

Any idea about this. If it's plz tel me....

Regards,

Shankar.

Former Member
0 Kudos

hai,

For this requirement you can open a new thread,not in this thread

thanks