cancel
Showing results for 
Search instead for 
Did you mean: 

reg popup while closing page

Former Member
0 Kudos

Hi all,

I have a requirement wherein i should get a popup while closing a webpage of BSP application that "Do you want to save". If user clicks "yes" then automatically the records changed in the page should save or if user clicks "no" the records should be unsaved.

Can anyone suggest any code?

Thanks and Regards,

Sneha.

Accepted Solutions (0)

Answers (1)

Answers (1)

eddy_declercq
Active Contributor
0 Kudos

Hi,

Pls check this web log

/people/eddy.declercq/blog/2006/03/20/wake-me-up-before-you-go-go

Eddy

-


Pimp up the S(D)N site and earn points. Check this <a href="/people/eddy.declercq/blog/2007/02/01/pimp-up-the-jam log</a> for details. Deadline Feb 15th!

Former Member
0 Kudos

Hi,

The web log is very helpful, its working, thanks for the wonderful web log, but i need one more clarification, here my page has tableview and in my page there are no specific input fields. all the inputs are in tableview, in this case where should i mention onchange attribute.

Thanks and Regards,

Sneha.

athavanraja
Active Contributor
0 Kudos

you need to enable for all cells.(editable)

where the cell id would be <tableviewid>_<rowno>_<columno>

and Eddy had given the code (below) for registering the event for inputfield.

<script for="a_field_name" event=onchange type="text/javascript">

needToConfirm = true;

</script>

Raja

Former Member
0 Kudos

Hi,

Do I need to enable for all rows also? but here my no of rows will vary depending on new rows created.

Can i enable this script when i select a row for editing and close without saving?

And where shall i write this script? in layout only? i define these cells in my iterator. Can i use this script in iterator?

Thanks and Regards,

Sneha.

raja_thangamani
Active Contributor
0 Kudos

<i>Do I need to enable for all rows also? but here my no of rows will vary depending on new rows created.</i>

-->Not requreid..select the rows which you wanted.

<i>And where shall i write this script? in layout only? i define these cells in my iterator. Can i use this script in iterator?</i>

--> You can write it in layout.

Raja T

Former Member
0 Kudos

Hi Raja,

Here it is a dynamic thing. User can modify any row and if he closes the page he shoud get warning message. Here How can i select the rows and enable?

Im displaying the tableview using iterator. Can you suggest how to write this code in layout, if possible with sample code.

Thanks and Regards,

Sneha.

raja_thangamani
Active Contributor
0 Kudos

To make the Row selectable & editable, use the below code..

      <htmlb:tableView id                    = "tv"
                         width                 = "200"
                         headerVisible         = "true"
                         design                = "alternating"
                         visibleRowCount       = "5"
                         fillUpEmptyRows       = "true"
                         selectedRowIndexTable = "<%= selected_ind %>"
                         selectionMode         = "MULTILINEEDIT"
                         tabIndexCell          = "false"
                         showNoMatchText       = "true"
                         filter                = "server"
                         sort                  = "server"
                         onHeaderClick         = "MyEventHeaderClick"
                         table                 = "<%= itab %>"
                         iterator              = "<%= iterator %>" >

<b>Page attribute:</b>

selected_ind	TYPE	INT4_TABLE

<b>To capture the selected Rows:</b>

<b>OnInputprocessing:</b>


  DATA: TV          TYPE REF TO CL_HTMLB_TABLEVIEW,
        EVENT       TYPE REF TO CL_HTMLB_EVENT,
        TABLE_EVENT TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  FIELD-SYMBOLS <I> LIKE LINE OF SELECTED_IND.

  TV ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = REQUEST
                                    NAME    = 'tableView'
                                    ID      = 'tv' ).
  IF TV IS NOT INITIAL.
    TABLE_EVENT = TV->DATA.
    CLEAR  SELECTED_IND.
    SELECTED_IND = TABLE_EVENT->PREVSELECTEDROWINDEXTABLE.

    IF TABLE_EVENT->EVENT_TYPE EQ CL_HTMLB_EVENT_TABLEVIEW=>CO_ROW_SELECTION.
      READ TABLE  SELECTED_IND WITH KEY TABLE_LINE = TABLE_EVENT->ROW_INDEX
        TRANSPORTING NO FIELDS.
      IF SY-SUBRC EQ 0.
        DELETE  SELECTED_IND INDEX SY-TABIX.
      ELSE.
        APPEND INITIAL LINE TO  SELECTED_IND ASSIGNING <I>.
        <I> = TABLE_EVENT->ROW_INDEX.
      ENDIF.
    ENDIF.
  ENDIF.

<b>SELECTED_IND will have the selected row index.</b>

Hope this will be helpful.

Raja T