cancel
Showing results for 
Search instead for 
Did you mean: 

How Can I pass parameters between views and customcontroller ??

Former Member
0 Kudos

Hi

I have created a model, a view and a custom controller. In my view I have a textfield associated with the model, So, When I press the buttom "Go" the view call a method in the custom cotroller, how I can view the value of the textfield in my customcontroller.

Note: The context view and the context of the custom controller are associated with the model.

Thanks !

Accepted Solutions (0)

Answers (3)

Answers (3)

arjun_thakur
Active Contributor
0 Kudos

Hi Yelimar,

You be be having an attribute that is binded to your text field. This attribute should be present in your component controller as well. If you want to access its value in custom controller then you need to map it first. For that first go to the custom controller's context tab. Click on controller usage and select the component controller and after that just drag and drop the context node, from component controller to custom controller, which you want to bind. Now in any method of the custom conroller simply read that attribute with the help of code wizard (ctrl+ F7).

Regards

Arjun

Former Member
0 Kudos

You should create an attribute type string in the context and bind it to the textfield.

Create an action for 'Go' button, onAction event is available for buttons.

In this event handler method write the following code to reda the value of the textfield,

data: l_elem type ref to if_wd_context_element.

l_Elem = wd_context->get_element( ).
l_elem->get_attribute( exporting name  = 'ATTRIBUTE NAME'
                        importing value = l_text  ).

" l_text will the value of your textfield..

Regards,

Radhika.

Former Member
0 Kudos

Hi,

Ideally we create attributes and node in context of Controller. Create attributes and node in view controller and map the nodes. You can then link the attribute in Node to text view element and in method of custom controller you can use the attribute of Custom controller.

Regards,

Priya