cancel
Showing results for 
Search instead for 
Did you mean: 

reset or clear input Fields in Web Dynpro

Former Member
0 Kudos
2,541

Hi,

i created a View with severel Input Fields. Normal Text Filds and Dropdown by Index Fields and some Date Fields.

Now i wanted to give the User the ability to clear his input.

I try to use Invalidate() but this kills my Dropdown Fields.

Is there a Function that resets my fields, without destroying my Dropdown Fields?

Regards

Tobias Kübler

seddam_kd213
Explorer
0 Kudos

bonjour

pouvez-vous me donner votre adresse mail pour vous contacter, j'ai besoin de votre aide.

merci

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Tobias,

I have a method of my componentcontroller which clears all nodes of the context, in effect resetting all views to their initial states.

  method refresh .
    wd_context->invalidate( ).
  endmethod.

Since I populate my dropdown lists in the componentcontroller WDDOINIT method, I can call wd_comp_controller->refresh( ) from any view and not lose the dropdown list value sets.

An alternate approach could be to put your code which populates your dropdown lists into a separate method. Then you could call

  lo_nd_mynode->invalidate( ).
  wd_this->initialize_node_dropdown( ).

Cheers.

Amy

Former Member
0 Kudos

Hi,

What Amy suggests is the best option.

The only other option would be to invalidate all nodes except the drop down context node.

Former Member
0 Kudos

thnks It was helps me too

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi All,

We can simply do this task by using code wizard...

Set the node attributes to null on click of RESET button.

For Ex.

i have LOGIN node with two attribute username and password.On click of Reset button we have to reset the values present in Username and Password I/O field.

Inside the Onaction handler of RESET button...code wizard + SET radio button + select the the LOGIN  node as context node.

0 Kudos

Thank you Venkateswararao sir for the help Very helpful !!!

Former Member
0 Kudos

I finaly Did it.

Thanks a lot for all helpers.

Former Member
0 Kudos

ah ok...so the WDDOINIT cann not be called....

lol how should i now this.

ok no i will move my coding...to method i think now this whis solve my problem...

i will report if i am successfull

Thanks to all helpers

Regrads Tobias Kübler

amy_king
Active Contributor
0 Kudos

Hi Tobias,

You cannot call the WDDO** methods yourself though you can add your own code to them. Those methods are called hook methods and are called by the Web Dynpro runtime during its processing flow.

Cheers,

Amy

Former Member
0 Kudos

Hi amy,

I have a similar situation.

Iam creating few attributes and respective input fields dynamically.

now the issue is how will I clear these fields once i press the clear button?

i need to dele all the dynamically created things.

will this refresh helps?

regards,

Vipin

Former Member
0 Kudos

ok no i get it a little bedder my fault was to create the method refresh in my view.

now i created it in the Component controles as Amy sad (shame on me)

an now i can use

this code

method ONACTIONCLEAR .

WD_COMP_CONTROLLER->REFRESH( ).

endmethod.

but again all DD Filds are gedding killed

Former Member
0 Kudos

How does your drop down gets filled? Do you have a method which fills your DD?

Say you have a method for example FILL_DD in your component controller to fill your drop down when the application starts, all you have to do is.

method ONACTIONCLEAR .

WD_COMP_CONTROLLER->REFRESH( ).

WD_COMP_CONTROLLER->FILL_DD( ).

endmethod.

Say you have a method for example FILL_DD in your VIEW to fill your drop down when the application starts, all you have to do is

method ONACTIONCLEAR .

WD_COMP_CONTROLLER->REFRESH( ).

WD_THIS->FILL_DD( ).

endmethod.

former_member211591
Contributor
0 Kudos

hmm... Move your code to populate your dd-list into a supply method.

1. create supply method for your dd-list node:

2. Double click "supplytest" and put in your code to populate it.

amy_king
Active Contributor
0 Kudos

Hi Tobias,

There are two parts to this approach. You've created the componentcontroller method refresh, but you also need to populate your dropdown lists in the componentcontroller's WDDOINIT method so that when the refresh happens, the WDDOINIT method is called by the runtime and your dropdown lists are repopulated.

Cheers,

Amy

Former Member
0 Kudos

I Created the Method REFRESH in my View

whith this coding

method REFRESH .

wd_context->invalidate( ).

endmethod.

In my Method  ONACTIONCLEAR (my button)

i wrote

method ONACTIONCLEAR .

WD_COMP_CONTROLLER->REFRESH( ).

endmethod.

but i get this error

Web-Dynpro-Comp. / Intf. ZWD_ABSOLVENTEN_BETA,Web-Dynpro-View ANLEGEN

Methode ONACTIONCLEAR

Die Methode "REFRESH" ist unbekannt bzw. PROTECTED oder PRIVATE.

Now it tryed

WD_THIS->REFRESH().

and i didnt get any errors and the button worked but my DD-Lists are geding killed (empty) as before

Former Member
0 Kudos

Yes. Correct.

You should have created the method REFRESH in Component controller. In this case you can use

WD_COMP_CONTROLLER->REFRESH() in VIEW.

Anyways, you have figured out a way to not get an error.

After WD_THIS->REFRESH().

Call the method that fills your drop down.

Former Member
0 Kudos

And this may help you.

Consider an example.

You have a component controller, a view VIEW1 and a method METH1.

Case 1: If METH1 is in Component Controller.

- You can call this method from within the component controller using WD_THIS->METH1.

- you can also call this method from VIEW1 using WD_COMP_CONTROLLER->METH1.

Case 2: If METH1 is in VIEW1

- You can only call this method from VIEW1 using WD_THIS->METH1.

Former Member
0 Kudos

My Method to fill the dropdown ist WDDOINIT

so i tryed

WD_COMP_CONTROLLER->WDDOINIT( ).

WD_CONTEXT->WDDOINIT( ).

WD_THIS->WDDOINIT( ).

but i get an error

Former Member
0 Kudos

You cannot call WDDOINIT method. It is only called from run time.

Do one thing.

Remove the code that fills DD from WDDOINIT and create a new method say for example FILL_DD.

Now write the code here.

1. Call this method from WDDOINIT

2. Also call this method from ONACTIONCLEAR. ( Remember, do this only AFTER invalidate( ). )

amy_king
Active Contributor
0 Kudos

Hi Tobias,

From what you wrote, you created the refresh method in your VIEW, but then you ask the COMPONENTCONTROLLER to execute it. If refresh is a method of your view, then your VIEW should call it. Otherwise create the method in your componentcontroller and then any view can call the method by asking the componentcontroller to execute it.

wd_comp_controller->refresh( ).

Cheers,

Former Member
0 Kudos

Ah ok it is possiple to refresh the hole Method WDDOINIT of the view...

but how?

Former Member
0 Kudos

There is no concept 'Refresh the whole method'.

You can refresh the context.

Former Member
0 Kudos

Hi Ismail,

ah i think now i understand. My DD-List ist actualy not created by supply functions, so i have this problem. Is there a list of Supply Functions for DD Lists mhh. maybe  someone here has a tip for me.

i Tink i can see a little light at the end of the tunnel 😄

Thanks for all Helpers

former_member211591
Contributor
0 Kudos

Just give Amy's first approach a try.

create method refresh at compcontrol:

  method refresh .

    wd_context->invalidate( ).

  endmethod.

And call this method from your view with:

WD_COMP_CONTROLLER->refresh( ).

amy_king
Active Contributor
0 Kudos

Hi Tobias,

"Is there a list of Supply Functions for DD Lists mhh."

A supply function is a method you write yourself to populate a node upon its initialization.

Cheers,

Amy

Former Member
0 Kudos

Hi Thank You for your help

but the Method

wd_comp_controller->refresh( )

does not exist. where can i find the method refresh()?

former_member211591
Contributor
0 Kudos

Hi Tobias,

you have to create refresh( ) by yourself. Refresh( ) must not be a method of the component controller, only if you have a context mapping from your view to your component controller. i.e. you can create refresh( ) also in your view-controller.

If you populate your drop-down list by a supply-function, the drop down list will be repopulated if you invalidate( ). invalidate( ) initializes all fields, thus also calls the supply functions .

so you have imho two possible approaches:

1. if you don't use supply-functions, you got to use Amy's approch. Refresh and populate yourself.

2. you use supply functions and just call invalidate( ). as you tried before.

So maybe it is easier for you to try the second approach. Change your method, which populates your drop-down-list to its supply function and test your component again.

BR,

ismail

former_member211591
Contributor
0 Kudos

oh I am sorry, I now get Amy's first approach.

She suggest to refresh at componentcontroller, thus WDDOINIT of the views will be called again.

This really would the easiest approach.

Any drawbacks?

amy_king
Active Contributor
0 Kudos

Hi Tobias,

The refresh method is a method that I added to the componentcontroller myself. Create a new method in your componentcontroller with the following code.

  
  method refresh .     
    wd_context->invalidate( ).   
  endmethod. 

Cheers,

Amy